apple of my i

Musings of an Apple fanboi

Developing on jailbroken iPhone 4S (5.1.1) with Xcode 4.4.1

First of all, the intent of this post is not to discourage iOS developers from creating a $99/yr developer account. Ultimately, all serious developers would and should. This post is meant to assist hobbyists or budding developers in their initial experimentation with a jailbroken iPhone to run their own apps.. at least until the time they get into serious iOS development. If you’re an Apple developer, chances are you love Apple and so, don’t do anything that harms Apple or the eco-system (includes developers).

The post is an update to I sincerely thank Alex for writing a detailed post that helped me in successfully running my test apps, developed under Xcode 4.4.1 on Mountain Lion with my iPhone 4S (5.1.1). As I discovered, there were a few (minor) changes required for 5.1.1 on Xcode 4.4.1 since the original post was targeted at an older version of iOS (4.x) and Xcode.  I sort of struggled to get a definitive guide anywhere on the Internet, and many stated methods just don’t work with 5.1.1. If you notice any technical errors in the post or have suggestions, please add a comment or feel free to write to me at v dot tmp at me dot com.

Essentially, there are 10 broad steps to accomplish this task. I’m not providing detailed descriptions of these steps here and assume that you understand most of it—you’re a developer after all.  If you need further clarity, do refer to the original post by Alex Whittemore.

            1. Jailbreak your iPhone 4S

              You can follow the instruction at the Greenpois0n site for jailbreaking your iPhone 4S (5.1.1). Works like a charm.. but do take a backup!
            2. Install AppSync for iOS 5.0+

              Open Cydia, and add as a source. I installed version 2.2 by Dissident.

            3. Create self-signed certificate

              Using Keychain Access create a self signed certificate with the name ‘iPhone Developer’. I guess other names should work as well but I just went with whatever has been mentioned in documentation elsewhere.

              Please wait for images to load below:

              Choose “Create a Certificate” using Keychain Access

              Select certificate name as “iPhone Developer”; type - “Code Signing”

              Specify a large validity period for your certificate

              You don’t have to put your email address there







              You should see “iPhone Developer” here

              Click on this certificate, you’d see something like (next slide)

              Verify your certificate details

              Before we move to Xcode related changes, here are  some suggested books for iOS development from Amazon[Advertisement]:

              Xcode Books:

            4. Modify Xcode plist files

              Close Xcode and change the following plist files for code signing and entitlement requirements

              • /Applications/








              • /Applications/

                Change (twice)



            5. Patch Xcode 4.4.1

              # cd /Applications/\ Build\ System\ Support.xcplugin/Contents/MacOS/ 
              # cp ./iPhoneOS\ Build\ System\ Support ./iPhoneOS\ Build\ System\ Support.orig 
              # printf “\xc3\x26\x00\x00” » ./iPhoneOS\ Build\ System\ Support 
              # chmod a+x iPhoneOS\ Build\ System\ Support
            6. Modify code signing requirements in Xcode to “do not sign”

            7. Tell Xcode to code sign

              # mkdir /Applications/
              # cd /Applications/ 
              # curl -O
              # mv gen_entitlements.txt 
              # chmod 777 
            8. Plug in your iPhone and configure for development

              Refer to Alex’ blogpost in case you’re not able to figure this out yourself.  I don’t even remember what I did.. but this wasn’t really an issue.
            9. Add a run script to your project build phase

              Here’s the exact script that you need to copy/paste.  A reader (Josh) reported some issues in copying/pasting this.. so get it from here (Thanks Josh) :

              export CODESIGN_ALLOCATE=/Applications/ 
              if [ “${PLATFORM_NAME}” == “iphoneos” ]; then 
                 /Applications/ “com.yourcompany.${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}/” 
            10. Make sure your iPhone is still connected and unlocked. Build and test on your phone:

              Well, that’s it. Your app should be on your iPhone now.  Look on the second screen.
              NOTE: Make sure you don’t name your app the same as an existing one.. like Calculator :-).  I overwrote the original Calculator on my iPhone.  In fact, if one of you can share the with me, that’ll be great (5.1.1) please.

              I had tried the other (simpler) approaches before this - like ldid -S or sysctl one.. they don’t seem to work with 5.1.1.  Please let me know if you’ve got them to work.
              Happy coding!
  1. ivishal posted this
blog comments powered by Disqus