Developing for a jailbroken iPhone A to Z (IOS 4.0.1 ))

Source: Internet
Author: User
Tags appsync
Note: It is said that this method can be used in xcode4

Jailbreak development for ios4!

Vital stats:
IOS 4.0.1
Xcode 3.2.3
Mac OSX 10.6.4 snow leopard
IPhone 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 re going to tell xcode that it doesn' tNeedTo codesign for iPhone OS targets, then we're re going to tell itDon'tCodesign for iPhone OS targets, then we're 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,

  1. 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 wocould 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 shoshould name the identity "iPhone developer" exactly to avoid having to change a bunch of the steps below.
  2. 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 using UE 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 shoshould 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.
  3. make some plist adjustments, starting with sdksettings. plist:

    View raw code?

    1. Cd/developer/platforms/iphoneos. Platform/developer/sdks/iphoneos4.0.sdk

    2. sudo CP sdksettings. plist sdksettings. plist. orig

    3. sudo VI sdksettings. plist

    Find

    View raw code?

    1. code_signing_required

    2. Yes

    and change Yes to no
    then find

    View raw code?

    1. entitlements_required

    2. Yes

    and change Yes to no again. hint: In Vi, you can type the '/'key in order to "cmd-F"

  4. Now, move on to the platform info. plist

    View raw code?

    1. CD/developer/platforms/iphoneos. Platform/

    2. Sudo CP info. plist info. plist. orig

    3. Sudo VI info. plist

    Two times, the following appears:

    View raw code?

    1. <Key> code_sign_context_class </key>

    2. <String> xciphoneoscodesigncontext </string>

    Find each occurrence and replace the block

    View raw code?

    1. <String> xciphoneoscodesigncontext </string>

    With

    View raw code?

    1. <String> xccodesigncontext </string>

  5. And now the real bad boy, some binary patching of xcode:

    View raw code?

      1. Cd ~ /Desktop

      2. VI script

    Hit the "I" key and copy/paste:

    View raw code?

      1. #! /Bin/bash

      2. CD/developer/platforms/iphoneos. Platform/developer/library/xcode/plug-ins/iphoneos \ build \ System \ support. xcplugin/contents/MACOs/

      3. Dd If = iphoneos \ build \ System \ support of = working BS = 500 COUNT = 255

      4. Printf "\ xc3 \ X26 \ x00 \ x00"> working

      5. /Bin/MV-N iphoneos \ build \ System \ support. Original

      6. /Bin/mv working iphoneos \ build \ System \ support

      7. Chmod A + x iphoneos \ build \ System \ support

    Type the keys, in order: ":" "X" "enter"

    View raw code?

      1. Chmod 777 script

      2. ./Script

    If it works right, You shoshould see something like

    View raw code?

      1. $./Script

      2. 223 + 1 records in

      3. 223 + 1 records out

      4. 111648 bytes transferred in 0.002678 secs (41692099 Bytes/sec)

    At this point, you're done telling xcode it doesn' tNeedTo Codesign. Now, we tell itDon'tCodesign:

  6. 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"

    Shocould look like this

    Now you 've told xcode "Don't Codesign ."

  7. Almost done: Time to tell xcode"Well, actually you shoshould Codesign ."

    View raw code?

    1. Mkdir/developer/iphoneentitlements401

    2. CD/developer/iphoneentitlements401

    3. Curl-O http://www.alexwhittemore.com/iphone/gen_entitlements.txt

    4. MV gen_entitlements.txt gen_entitlements.py

    5. Chmod 777 gen_entitlements.py

  8. Just hit cancel.

    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 haveDo 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:

View raw code?

    1. Export codesign_allocate =/developer/platforms/iphoneos. Platform/developer/usr/bin/codesign_allocate

    2. If ["$ {platform_name}" = "iphoneos"]; then

    3. /Developer/iphoneentitlements401/gen_entitlements.py "My. Company. $ {project_name}" $ {built_products_dir}/$ {wrapper_name}/$ {project_name}. xcent ";

    4. Codesign-F-s "iPhone developer" -- entitlements "$ {built_products_dir}/$ {wrapper_name}/$ {project_name }. xcent "" $ {built_products_dir}/$ {wrapper_name }/"

    5. 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 shoshould do it. Take all those steps and you shoshould 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 have CT 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 0 xffffffffff none
mem 0x00000000 0x0fff none
RUN
running...
[Switching to thread 11523]
[Switching to thread 11523]
continue
warning: unable to read symbols for "/library/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 instils, 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?

What gives ?!

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 Intelli Born 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 stored ed signal:" SIGUSR1 ". at which point the application hangs. conveniently, the workaround is easy, if annoying: For your par Ticular 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 'contine' through it. and obviusly, disabling backgrounder for your app prevents the signal from getting sent.

Tagged as: iPhone, jailbreak development, jailbroken, xcode leave a comment

Comments (308) trackbacks (12) (subscribe to comments on this post)

  1. Zee
    May 17th, 2011-

    Hi, I tested this on xcode 4.0.1 and iPod Touch 4G 4.3.3. My Snow Leopard runs on Vmware. No problems here. I was able to deploy and debug my app. Thanks much Alex!

  2. Stinkycat
    May 20th, 2011-06:22

    I did it! Thanks to Gerard Henninger (rjl 15th, 2011-) I was able to surpass the 'clock thing 'problem and I just tried my app in my iPod. my system is xcode 4.0.1 and I have 4.3.3 JB on my iPod 4G. (Notice that I had to have it unjb to add it to the organizer ). well thank you so much for everything Gerard and obviously this whole Guide

  3. Sun. Wael
    May 26th, 2011-

    Duuuuuuuuude, you are awesome !!!!

  4. Kumait
    May 28th, 2011-

    Very nice, you are great, it works for me perfectly

  5. Sam
    May 28th, 2011-

    Alex, had this working ages ago, thankyou so much.

    I recently upgraded to latest 4.0.1 XC + 4.3.3 JB on 3gs .. The * same * error that I had previusly regarding the "symbols" for debugging occurred, last time it was backgrounder.

    I did disable multitasking (http://jaxov.com/2011/05/disable-native-multitasking-on-iphone-ipod-touch-ipad-running-ios-4-3-3/) and when I tried to install backgrounder it failed .. But I didnt persist.

    Any ideas what I cocould be doing wrong?

    Thanks
    Sam

  6. Sam
    May 28th, 2011-

    Alex,

    Here is the output, maybe its all working fine, apologies in advance, am just getting back into this after a long break.

    Thanks
    Sam

    Gnu gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:56:02 UTC 2011)
    Copyright 2004 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    Welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB. Type "show warranty" for details.
    This GDB was configured as "-host = x86_64-apple-darwin-target = arm-apple-Darwin". tty/dev/ttys000
    Target remote-mobile/tmp/. XcodeGDBRemote-661-35
    Switching to remote-MacOSX Protocol
    Mem 0 × 1000 0x3fffffff Cache
    Mem 0x40000000 0 xffffffff none
    Mem 0 × 00000000 0x0fff none
    [Switching to process 11779 Thread 0x0]
    [Switching to process 11779 Thread 0x0]
    Re-enabling shared library breakpoint 1
    Warning: unable to read symbols for/library/mobilesubstrate. dylib (File not found ).
    Warning: unable to read symbols for/library/frameworks/cydiasubstrate. Framework/libraries/substrateloader. dylib (File not found ).
    23:39:57. 045 slider4 [597: 607] MS: Notice: Installing: sammys. slider4 [slider4] (550.58)
    23:39:57. 090 slider4 [597: 607] MS: Notice: loading:/library/mobilesubstrate/dynamiclibraries/Activator. dylib
    Warning: unable to read symbols for/library/mobilesubstrate/dynamiclibraries/Activator. dylib (File not found ).
    23:39:57. 622 slider4 [597: 607] MS: Notice: loading:/library/mobilesubstrate/dynamiclibraries/intellistatusiconsview. dylib
    Warning: unable to read symbols for/library/mobilesubstrate/dynamiclibraries/intellistatusiconsview. dylib (File not found ).
    23:39:58. 185 slider4 [597: 607] initializing intellistatusbaricons v0.93
    23:39:58. 195 slider4 [597: 607] initialized listener for icon updates
    23:39:58. 244 slider4 [597: 607] MS: Notice: loading:/library/mobilesubstrate/dynamiclibraries/winterboard. dylib
    Warning: unable to read symbols for/library/mobilesubstrate/dynamiclibraries/winterboard. dylib (File not found ).
    Warning: unable to read symbols for/developer/platforms/iphoneos. Platform/devicesupport/4.3.3 (8j2)/symbols/usr/lib/libsubstrate. dylib (File not found ).
    23:40:00. 422 slider4 [597: 607] WB: Notice: winterboard
    MS: Warning: Message not found [uiimage defaultdesktopimage]
    23:40:00. 502 slider4 [597: 607] MS: Notice: loading:/library/mobilesubstrate/dynamiclibraries/libstatusbar. dylib
    Warning: unable to read symbols for/library/mobilesubstrate/dynamiclibraries/libstatusbar. dylib (File not found ).
    23:40:01. 256 slider4 [597: 607] cocould not find mapped image silver_linotif.png
    Program ended with exit code: 0

  7. Eduardo Brazil
    May 30th, 2011-

    TKs a lot it works for me-Congratulations !!!

  8. anony
    June 1st, 2011-06:42

    I was able to run it on iPhone 4 by enabling breakpoints and then starting the debug. it gives an error sometimes but keep trying as it does work too.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.