The Goal: Get live on-device XCode debugging without being a paying ADC member.
Abstract: The iPhone uses code-signing to restrict what gets run on the device. Under normal conditions, this means that John-developer signs up with ADC (Apple Developer Connection) and gets, among other credentials, a code signing identity. He downloads a certificate, plugs all the info into XCode, and when he compiles his project for debugging or release, it gets signed with this certificate. When it gets transferred to an iPhone (say, for debugging) or released to the App Store, this signature gets checked to ensure that the code came from a registered, trusted ADC member.
What WE want to do is run our own code, developed in XCode, on our iPhone without this valid certificate from Apple. Part of this process allows code from OTHER non-ADC-signed developers to run on other phones, but that’s not the real point. The goal of THIS tutorial is to make the Build and Go live-on-device debugging work on a jailbroken iPhone without the proper signature, in other words without the need to pay. Note: this does not allow you to develop for the App Store. This is only good if you’re only developing for yourself or you plan to distribute only for jailbroken phones/iTouches.
- You’ll need a jailbroken iPhone (or iTouch). The specific jailbreak method I used is posted at the iPhone Dev Team link below, but it doesn’t much matter. It only matters that your device is jailbroken and has Cydia installed.
- You will need a signing identity. We’ll break the check such that it doesn’t have to be an official ADC one, so you can make your own using this guide from apple (coral). What you are doing in this step is creating a “Self-Signing Identity.”
- Break signature checks on your phone. This used to be a big pain. Luckily, there is a super-easy way to do it these days. Add the repository http://iphone.org.hk/apt to Cydia on your phone. Then, update your sources (should be automatic) and search for the MobileInstallation Patch. The current version supports os 2.2, and I’ve found that it gets updated pretty quickly after new releases. Note: There is an alternate version of this step, should this method break for any reason. You can also add the repository http://cydia.hackulo.us and use the package MiPatch. The two do the same thing. I’ve not tested this alternate method, but I have no reason to suspect that it doesn’t work.
- Make a backup of the file
/Developer/Platforms/iPhoneOS.platform/Info.plistthen edit it to include the bit in red:
(step copied from post two of iphonesdkdev.blogspot.com below)
- (Updated 12/24/08) Open your project and go to (menu) Project > Edit Project Settings. In the list of properties, find “Code Signing Identity” > “Any iPhone OS Device” and click in the empty box. Assuming there are no entries in the menu, click “Other” and type in the same name you used to generate the code signing certificate above in step (2). For example: in step 2, I used the name “iPhone Developer” and that is exactly what I put in this field. Hit OK and close that settings window. This setting should persist in future projects, and you shouldn’t have to do this again (whereas, for example, you’ll have to repeat step 6 for each project).
- Add the following to the Info.plist for your project:
<string>Apple iPhone OS Application Signing</string>
UPDATE 12/24/08: I realized after a few comments from other blogs that I totally forgot to add the step where you actually USE the code signing certificate you created. I believe that step 5 is correct, so please re-try this. Otherwise, the first post above from iphonesdkdev.blogspot.com should have, somewhere inside, what you need. If the procedure above doesn’t work, please try looking around that post and let me know what step I need to add. It’s difficult to recreate exactly what I did now that my setup works.
UPDATE 1/14/2009: One of the commenters pointed out a key point: After you’ve generated the certificate and configured xcode, you MAY have to restart to get things working, else you may get an “Codesign error: no certificate for identifier “iPhone Dev” was found in your keychain” error. If a restart doesn’t fix it, see my comment below following his.