Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Both for kicks and for budgetary reasons, I'd like to take a package that would normally requite a developer account and build an app to run on a jailbroken iOS device.

I have a 5th gen iPod Touch, jailbroken using evasi0n, running iOS 6.1.

I am using Xcode 4.6 with OS X (10.8.2) Lion.

share|improve this question

3 Answers 3

The following instructional steps to accomplish this purpose are taken from: http://iphonedevwiki.net/index.php/Xcode

My findings and actions are provided under each step.

1. Create a self-signed code-signing certificate with the name “iPhone Developer” on the “login” (default) keychain using Keychain Access.

  • I took screenshots as I followed the above instruction.
  • I left most fields blank or at their default value.

enter image description here

2. Open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Info.plist (4.2 or below: /Developer/Platforms/iPhoneOS.platform/Info.plist). You may need root permission.

  • I'm using Xcode 4.6, so I opened the former .plist file.

3. Replace all occurrences of XCiPhoneOSCodeSignContext by XCCodeSignContext. There are three of them (XCode Version 3.2.4+).

  • I made three modifications as the screenshots indicate.

enter image description here enter image description here enter image description here

4. Save the file and restart Xcode.

  • Saved the file.

5. Make sure you have ldid on your Mac. Place a copy somewhere e.g. in /usr/local/bin.

6. Create the a Python script ldid3.py right next to the ldid program. Make it executable. Fill it with:

#!/usr/bin/env python

from sys import argv
from subprocess import check_call
from os.path import basename, dirname, splitext, join
from tempfile import NamedTemporaryFile

app = argv[-1]
ldid_path = join(dirname(__file__), 'ldid')
obj_path = join(app, splitext(basename(app))[0])

if '-gta' not in argv:
    check_call([ldid_path, '-S', obj_path])
else:
    with NamedTemporaryFile('w+b', 0) as f:
        f.write("""
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>get-task-allow</key>
    <true/>
  </dict>
</plist>
        """)
        check_call([ldid_path, '-S' + f.name, obj_path])
  • I created a new plain text file and copy-pasted the above code into it.
  • I saved this file as ldid3.py and stored it in the /usr/local/bin directory.
  • In terminal, ran chmod 777 /usr/local/bin/ldid3.py.

7. Open iPhoneCodeSign.xcspec. This file can be found in [For Xcode 4.6: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Specifications/iPhoneCodeSign.xcspec]:

8. Change the entry in the file from calling codesign to ldid3.py.

  • As per instruction official instruction, converted the spec file to plain text by typing in console: sudo plutil -convert xml1 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Specifications/iPhoneCodeSign.xcspec
  • I opened the file with TextEdit.
  • Replaced <key>CommandLine</key><string>/usr/bin/codesign</string> with <key>CommandLine</key><string>/usr/local/bin/ldid3.py</string>.

9. Save the file and restart Xcode.

  • I saved the file and quit TextEdit.

10. Create a file /var/mobile/tdmtanf on the device, to enable Apple's "TDMTANF bypass" in installd (warning: doing so will also put you in a sandboxed GameCenter).

  • I create an empty text file in Windows, named it tdmtanf, SSH'd into my iPod, uploaded it to /var/mobile/, and reboot my iPod.

Now that all that is over with...

I open my existing Xcode project and hit Run. It works in the iOS Simulator without any problems.

enter image description here

I make sure that Code Signing is set to use the certificate set up in step 1.

enter image description here

I build the app (Project > Build). A success message follows.

I grab my app folder TicTacToe.app from /Libary/Developer/Xcode/DerivedData/TicTacToe-cjgzmoxtflyegtfypsbxbuiuwxns/Build/Products/Debug-iphoneos/ and transfer it to my Windows machine to install onto my iPod.

In an attempt to install the app to my iPod, I drag TicTacToe.app onto the applications section of iPhone Configuration Utility, but I received this error message saying that my app "is not a valid mobile application."

I have also tried manually installing the app using iFunbox and the AppCake app found in Cydia. Both fail.

enter image description here enter image description here

As a point of interest, because as I've Googled around, I've noticed many people mention the importance of this: I do have AppSync installed. (Sorry for the huge screenshot. If I should take it down, please let me know!)

enter image description here

Conclusion

So despite following the instructions closely, several times, my app is not recognized by iPhone Configuration Utility as a valid app. I cannot install the app manually using programs like iFunbox, or Cydia apps like AppCake.

I suspect the app is indeed invalid, but having followed the instructions carefully, I'm not sure why.

Can anyone tell me why my app is not valid, and what I can do to fix this, besides coughing up money that is?

share|improve this answer
    
It was an interesting reading, though. –  Thecafremo Feb 21 '13 at 8:25
    
Nope - glad to have read it and will probably return to it in the future. Thanks for sharing it. –  Robert Feb 21 '13 at 16:23
    
This was very helpful to me when working on Xcode 4.2 and iOS 4, I hope someone can update the procedure to Xcode 4.6 –  rraallvv Mar 5 '13 at 1:25
    
After downloading ldid you need to change its permissions to 755 with chmod 755 ldid. This was causing me an exit 1 error. –  user46393 Mar 31 '13 at 5:18

You can connect your device and select your iOS Device as Run target. when its run, the application automatically installed on your device. Or you can select your iOS Device, then no need to Run just Build and Archive it. After that, distribute... choose Save for Enterprise or Ad-Hoc Deployment. You'll get your .ipa file. Hope it can help you..

share|improve this answer

continuing @joncom s answer.. you can add the .app files to your iPhone directly, just with a few extra steps.

  • copy the .app file onto your desktop, and then zip it
  • rename the [yourappname].zip to [yourappname].ipa
  • then go ahead and download AppSync from cydia
  • download and install the .ipa file onto your device

NOTE:

you can also do this directly without going through all the python code modification the @joncom mentioned.. read more here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.