Vital Stats:
iOS 4.0.1
Xcode 3.2.3
Mac OSX 10.6.4 Snow Leopard
iPhones 3G, 3GS, 4 (I finally have the whole lineup!)
PROBLEM: I still can’t get iPhone 4 working. If you have one, please try it and help me out! UPDATE: Found the cause of the problem to be certain status bar libraries installed alongside other apps. I’m not sure why they cause the problem, but see full notes at the bottom of the post.
The Goal: As usual, we want to be able to click “build and go” in Xcode and get the app we’re working on to load to the phone and start up. Also, we want to be able to debug from within Xcode itself. After all, Xcode is cool, and terminal+makefiles+gcc+gdb is lame.
Abstract: The plan remains unchanged from the 3.x method. In fact, you commenters practically wrote this one for me. This time we’re going to tell Xcode that it doesn’t need to codesign for iPhoneOS targets, then we’re going to tell it don’tcodesign for iPhoneOS targets, then we’re going to tell it, well, actually, codesign but do it using our script, not your built in method.
The Process: With Xcode closed and your device unplugged from the computer,
- If you’ve done this step before for previous guides, you may ignore it. You’ll need a code signing identity in order to sign code to run on the device. Normally, this would be issued by Apple, but later on we’ll break the signature check so you can make a “Self-Signing Identity” using this guide from apple (coral). Note that you should name the identity “iPhone Developer” EXACTLY to avoid having to change a bunch of the steps below.
- On your jailbroken iPhone, install the app AppSync. Add the source http://cydia.hackulo.us to cydia. You’ll get a warning about pirating software: this patch, by virtue of breaking Apple’s DRM so that we can install our own app, also enables us to install cracked App Store apps. Don’t do that. It’s immoral, fails to support legitimate developers who should be rewarded for their effort, and perhaps above all, pirating $2 cell phone apps is just ultra lame. But since our purposes are not nefarious, dismiss the warning. From this repo, install the package AppSync for OS 4.0, and for good measure, reboot the device.
- Make some Plist adjustments, starting with SDKSettings.plist:
cd /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk sudo cp SDKSettings.plist SDKSettings.plist.orig sudo vi SDKSettings.plist
Find
CODE_SIGNING_REQUIRED YES
and change YES to NO
then findENTITLEMENTS_REQUIRED YES
and change YES to NO again. HINT: in vi, you can type the ‘/’ key in order to “Cmd-F”
- Now, move on to the platform Info.plist
cd /Developer/Platforms/iPhoneOS.platform/ sudo cp Info.plist Info.plist.orig sudo vi Info.plist
Two times, the following appears:
CODE_SIGN_CONTEXT_CLASS XCiPhoneOSCodeSignContext
Find each occurrence and replace the block
XCiPhoneOSCodeSignContext
with
XCCodeSignContext
- And now the real bad boy, some binary patching of Xcode:
cd ~/Desktop vi script
hit the “i” key and copy/paste:
#!/bin/bash cd /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneOS\ Build\ System\ Support.xcplugin/Contents/MacOS/ dd if=iPhoneOS\ Build\ System\ Support of=working bs=500 count=255 printf "\xc3\x26\x00\x00" >> working /bin/mv -n iPhoneOS\ Build\ System\ Support iPhoneOS\ Build\ System\ Support.original /bin/mv working iPhoneOS\ Build\ System\ Support chmod a+x iPhoneOS\ Build\ System\ Support
type the keys, in order: “:” “x” “enter”
chmod 777 script ./script
If it works right, you should see something like
$ ./script 223+1 records in 223+1 records out 111648 bytes transferred in 0.002678 secs (41692099 bytes/sec)
At this point, you’re done telling Xcode it doesn’t need to codesign. Now, we tell it don’t codesign:
- With a new project open and ready to go (presumably you want to debug this one, though once you change these settings once, they’ll persist from project to project) open Project>Edit Project Settings (from the menu). Click on the “Build” tab.
Find “Code Signing Identity” and its child “Any iPhoneOS Device” in the list, and set both to the entry “don’t code sign”Now you’ve told Xcode “don’t codesign.”
- Almost done: time to tell Xcode “well, actually you should codesign.”
mkdir /Developer/iphoneentitlements401 cd /Developer/iphoneentitlements401 curl -O http://www.alexwhittemore.com/iphone/gen_entitlements.txt mv gen_entitlements.txt gen_entitlements.py chmod 777 gen_entitlements.py
-
And finally, to link the device and computer. Plug your iPhone in and open Xcode. Open Window>Organizer. Select the device from the list on the left hand side, and click “Use for development.” You’ll be prompted for a provisioning website login, click cancel. It’s there to make legitimate provisioning easier, but doesn’t make illegitimate not-provisioning more difficult.
Now you’re good to go! But there’s just one last thing. You have to do this last part for every new project you make. Go to the menu Project > New Build Phase > New Run Script Build Phase. In the window, copy/paste this:
export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate if [ "${PLATFORM_NAME}" == "iphoneos" ]; then /Developer/iphoneentitlements401/gen_entitlements.py "my.company.${PROJECT_NAME}" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent"; codesign -f -s "iPhone Developer" --entitlements "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/" fi
That will call the script you just downloaded in step 5 to sign our app with a fake signature. This is important only for debugging. If you do build and go otherwise, the app will load to the phone, but the app will fail to launch and you’ll get:
Error from debugger: The program being debugged is not being run
That should do it. Take all those steps and you should be home free for JBDev without paying $99.
CREDITS: Once again, credit for this process goes to various posters in this forum thread at iphonedevsdk.com. All of these steps are there somewhere, it just took a while to re piece them together in the right combination.
iPhone 4 Issue (UPDATE see below): So the method above has been tested working for my 3G and my 3GS. I don’t have my 2G right with me, but I expect it’s no different from the previous method, given that it can’t run iOS4.
The problem that I run into is this:
[Session started at 2010-08-04 20:35:02 -0400.]
//GDB stuff
Program loaded.
target remote-mobile /tmp/.XcodeGDBRemote-93925-69
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
run
Running…
[Switching to thread 11523]
[Switching to thread 11523]
continue
warning: Unable to read symbols for "/Library/MobileSubstrate/MobileSubstrate.dylib" (file not found).
// A bunch of other lib load warnings like this here...
warning: Unable to read symbols for "/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0.1/Symbols/usr/lib/libcrypto.0.9.8.dylib" (file not found).
Debugger stopped.
Program exited with status value:45.
The killer is that the app installs, launches, crashes, and then launches fine manually. But I also can’t connect GDB to the running process after the fact either, GDB claims the process isn’t running. I have no idea what’s going on. Anyone?
UPDATE (8/3/10): Totally by chance I happened to read this article on TUAW today about FaceTime. I didn’t pay much attention until about half way down something caught my eye:
…rather significant My3G bug — when installed, you cannot use your iPhone for native software development….
I had initially thought that maybe third party software was to blame but I meticulously disabled each MobileSubstrate extension I had one at a time and ruled them all out. Turns out that wasn’t good enough. The (since fixed) My3G bug was exactly the source of this issue, but I had actually uninstalled My3G and the problem persisted. The issue, it turns out, is with the status bar library Intelliborn uses in their products, IntelliStatusBarIcons. BUT, it doesn’t stop there. By individually uninstalling apps, I’ve found that Backgrounder (and NOT libstatusbar) also cause a dealbreaking bug. Instead of the program exiting with status:45, the new error is “Program received signal: “SIGUSR1”. at which point the application hangs. Conveniently, the workaround is easy, if annoying: For your particular project title, add an Override in Backgrounder. Hopefully this IS a bug in Backgrounder and not a byproduct of its function. But at least now you can debug again!
So partly I’m dumb and partly this is just a bummer. Full story in this post, but the general idea is that gdb catches a SIGUSR1 from Backgrounder and you have to ‘continue’ through it. And obviously, disabling Backgrounder for your app prevents the signal from getting sent.
it’s works with XCode4 with IOS 4.2
Thanks for sharing
[…] Via > Siga-nos no Twitter […]
I love you, it works fine.
I found myself stuck trying to build/run the application from Xcode, therefore I chose iPhone from Organiser, add application, walkthrough the folder containing the build and add it. Instantly its being added to the device.
Thanks a million. Now I can decide if its worth it to release the app.
@Braindon dit you follow this guide http://www.ipodtouchfans.com/forums/showthread.php?t=292945 as I did because I got the same problem or did you fix your problem please say how
Great! thank you very much.
It’s works with Xcode 3.2.4 with IOS 4.1 (3GS)
@timo
i followed alexwhittemore’s guide as i want to debug on device
@ leopold
im still stuck with this shit, gonna try reinstalling xcode today
found this, building on alex work
UPDATED Please read the full description for more info.
(UPDATE) The patch is now geared towards iOS 4.1 development. If you wish to use 4.0 development, change “4.1” to “4.0
and “41” to “40” where necessary in the script.
I’ve created a really easy bash script for you to run and get Xcode all ready for you to simply create applications straight to your device (provided it’s jailbroken of course).
(UPDATE) the phile.biz server is down for now you need to use
some other sources to get these files, I apologize.
Updated links for everything are here.
(UPDATE) The script now located here:
http://pastie.org/1210052
(UPDATE) The templates can be downloaded as shown in the script here:
http://www.mediafire.com/?h6o2229bh6k…
Alex’s blog you can follow the same steps, but my bash will work better because it’s done for you: (UPDATED)
http://www.alexwhittemore.com/?p=398
All the stuff in the bash was basically from him but in bash and automatic-ified.
The only work I did was put it together and make the Xcode Project patches.
NOTE: If you’re experiencing some “iPhone Developer no identity found” problems, check this out:
http://pastie.org/1078299
NOTE: If you get problems with running on your device, make sure you add the Hackulous source at [http://cydia.hackulo.us] and install [AppSync for 4.1].
After reinstalling xcode i used aforementioned method and it works like a charm! Thx Alex
Ваша информация на тему – Developing for a Jailbroken iPhone A to Z (iOS 4.0.1) « alexwhittemore.com вашего сайта http://www.alexwhittemore.com просто классная. Правда жаль что видео нет.
How do you accomplish this in XCode 4? I can’t find the Build-Settings where I should turn off Code-Signing. There are also two options for the Skript: 1. Run before Build 2. Run after Build.
Thanks for any help.
This is a little utility that cracks xcode itself without any coding: http://www.dbmolabs.com/applicazioni/xcrack xD
it works perfectly on OSX 10.6.6 iPhone4 iOS 4.1 Xcode 3.2.4
this tutorial is very useful. thank you very much!! n___n
I got it working on Xcode4 Preview 6!
@Domi, under your project name is the project setting. Click on that and you can access your build settings.
One thing I had to do was to unplug and replug in my iPad after setting the device for development so Xcode can import the debug files.
Good luck!
Took me a bit to figure out that you have to press the escape key after pasting that code in, THEN 😡 enter, to run the script, works perfectly now. Finally I can run my apps!
OS X 10.6.6 iPod Touch 4G iOS 4.0 Xcode 3.2.5 with iOS 4.2 SDK
was unable to get this working 4.2.1. anybody get it to work? downgraded back to 4.1 where this method works fine.
I followed all steps, and get these errors:
Application failed codesign verification. The signature was invalid, or it was not signed with an Apple submission certificate. (-19011)
Unable to extract entitlements from application: /Users/Nico/Documents/iPhone Apps/Untitled/build/Release-iphoneos/Untitled.app (-19045)
I added the run script build phase, but it still doesn’t seem to sign the app. Any ideas?
iPhone 4 (No intelliborn stuff installed)
xcode 3.2.5
iOS SDK 4.2.1
Got AppSync as well.
Daniel, i’m seeing to the message:
CodeSign error: The entitlements file ‘/Users/XXXX/Documents/test/NO’ is missing
How did you solved it?
thanks
Never mind, i messed up when editing SDKSetting file… everything working now 😀
Upon further testing, I figured that I only get this error when xcode tries to launch the app. When I launch it manually, it works! Even if I don’t add the run script build phase!
Thanks a lot!
Thanks a lot, you’re a genius… However I tried also the debugging on an iPhone 4 with iOS 4.2.1, and simply worked fine.
So thank you very much again!
Each Time i Build and Run i keep getting an “Command /bin/sh failed with exit code 1” Error
The Run Script is failing at codesign -f -s ‘iPhone Developer’ –entitlements …
with error “iPhone Developer: no identity found”
on SDK 4.2.5 (changed script shel to “/bin/sh -x” to see output in Build results)
Will post if I find solution
Found it, muffed the self signed, code signing certificate step…
how to revert back the custom script execution. i have membership now and this custom process is causing error process. how to stop custom script running?
Hi, thanks for this nice post, i’ve a question..
I’m working with a microcontroller to communicate with the iphone. I have to open the serial port to send data over UART…if i install normally my app with xcode i cant open the serial port(error opening file /dev/tty.xx)
I think the app is in the sandbox, but if the app is in ~/Applications folder (where there are Cydia.app etc..) i can open the serial port and communicate over uart, my problem is that in this way i can’t degub my code.With this guide do you think that allow to open file descriptors(serial port in my case)?
XC 3.2.5 iOS 4.2.1 Leopard 10.6.6 iPad 4.2.1
Working like a charm! Thanks.
Note: (@yestertech) Missing identity error is showing if you skip certificate creation. Apple changed the keychain wizard. So the steps to get selfsigned certificate is little bit different. There is not Code Singing pulldown and you must check code sign later in wizard (Codesign certificate extension).
Hi guys,
thanks for the tutorial ! But now i’m running in the “iPhone Developer: no identity found” problem !
Can you please tell me what in detail I have to do to solve it ?
Thanks a lot !
thx it worked, but when i click build and archive, isn’t creating .ipa…. any idea?
Fantastic. This method even works to install Gamesalad Viewer. Thanks!!
I had the same errors as Nico, but after transferring the .app file to my phone and manually moving it to /Applications, I can launch it just fine.
Thanks for the instructions. But I wonder if this also works on iPad? cuz I follow the steps but still I can only run the app on my ipad. Debugging would only result in the message Error from debugger: The program being debugged is not being run. 🙁
Dude, you and every person this method is from, well, you are genius!
I was trying for months and finally I got this working (on an iPhone 4 – iOS 4.2.1). Thanks you so much and keep going like this, I love your blog! 😉
My ipod touch is a new one, so i cant downgrade from 4.2.1 to 4.2, my dev environment is xcode 3.2.5 with ios 4.2
After actions through this post, i got the message like “unknown ios version”
how can i test my app?
any help? thanks a lot
with xcode 3.2.2 and sdk 4: \The identity used to sign the executable is no longer valid. Please verify that your device’s clock is properly set, and that your signing certificate is not expired.\
(0xE8008018)
HI,
Thanks for your work!
I followed each one of the steps, but when i choose Project>Set Active SDK>’Device’ i m getting the error : iPhone Developer : no identity found.
I ve created the keychain account though.
Any help would be appreciated!:)
thanks in advance.
Definitively It works!.
I’m still get the same error (-19XXX) like Nico but only when “Build and Run” the app in the Device. Running the app in the Simulator with just “Build” it’s OK.
Thanks for your great work and blog
OS X 10.6.4
iPod Touch 3G iOS 4.1
iPhone 3G and 4
Xcode 3.2.4 with iOS 4.1 SDK
Hell yeah baby, thanks alot this worked exactly like you said. Much thanks!!!!!!!!!!!!!!!!!!!!
Thank you! worx wonderfull! testing with xcode 3.2.5 on a 2g iphone.
Have to launch the app manual though
greets
This also works on a jailbroken iPhone4 4.2.1 with Xcode4 GM 2. U just have to use the correct deployment target…
MAN, IT WORKS!!!! I’M SO HAPPY! AFTER SO MANY HOURS TRYING TO MAKE IT WORK I FINALLY GOT IT!!!
Thanks @foven for the tip. I could not get it without you.
OSX 10.6.4
iPhone 4
xCode 3.2.5 and iOS 4.2.1
Brazil rocks!!
Doesn’t work on Xcode 4, “No provisioned iOS devices are available”.
Xcode 4 works for me… Don’t know what Joe did wrong. Works fine, added the build script, and made sure my iPhone was giving me the green light in the Organizer.
Xcode 4 from Mac App Store
iPhone 4 4.2.6(Verizon)
OS X 10.6.6
Thanks guy, wonderful tutorial~Now i can run my apps on the phone pretty well
Xcode 3.2.5 with iOS SDK 4.2
iPhone 3g with iOS4.2.1
OSX 10.6.6
Joe, you need to set the deployment target to whatever fw you are using on your idevice.
first: Project info: (your project), Deployment target (in my case 4.2)
then Target summary: (your target), Deployment target (in my case 4.2)
i hope that i helped.
@david: thanks for your answer, i just found out, that i had forgotton to re-install AppSync after a restore 😉
It’s working now
I’m get this error when I Add New Run Script Build Phase:
iPhone Developer: no identity found
Command /bin/sh failed with exit code 1
I can get my app to work manually on my iphone without the Build Phase Script. But no debugging info.
Can anyone please help?
I have added “iPhone Developer” in my keychain, and it’s working like a charm now.
(I’m using it for educational purposes)
Great thanks.
This worked for me on XCode 3.2.5 but not with XCode 4 after a clean install. I’m not seeing the “Use for development button” in Organizer for some reason. Previously I saw this button and then it loaded debugging symbols and stuff and then I could run my apps on the device. Any tips are greatly appreciated. I’m running OS X 10.6.6 btw.
I m getting the error :
iPhone Developer: no identity found
Command /bin/sh failed with exit code 1
I have added iPhone Developer in my keychain though.
I m using xcode 3.2.5
If someone can help me….
Thanks in advance
I am using xcode 4.0 and iOS 4.2.1. I went through each of the steps above without any problems, but when I build and run I get the message “Xcode cannot run using the selected device. No provisioned iOS devices are available” ? Did I miss something? When I look at the device in Organizer there isn’t any Provisioning profile on the device or in Xcode, Am I supposed to have one of those? If so, I do I create?
my xcode4 don’t exports the environment to the script in build phase. If I save to file the result of /usr/bin/env there isn’t any definition of $PLATFORM_NAME or $PROJECT_NAME…
If I run the script from terminal the app can install and debug on my iphone.
tnx, got it working