iphoneiosxcodejailbreak

Jailbreak development using xcode


I have been looking around for learning how xcode can be used for jailbreak development.

I have Lion and jailbroken iPhone3G and xcode4.6 which doesnt support iPhone3G.

I have installed ldid but have no idea how to use it.

I have to make launch daemons, too, and attach them with my application. I have followed this tutorial for making a daemon but i got stuck in the setup for creating an open tool chain template in xcode. I followed every step but my xcode is not showing any template for open tool chain. Is it really required to have open tool chain template?


Solution

  • You're right. Xcode 4.6 doesn't support the iPhone 3G. Can you install an older version of Xcode? For example, Xcode 4.4 still supports the 3G.

    Login to the Apple Developer Portal and download old versions here

    You can choose to install the old version of Xcode in a different folder, so that it doesn't overwrite the new version (for example, install to /Developer-old/ or something).

    Once you install the old Xcode version, you can navigate to the installation directory and look for the directory named:

    iPhoneOS5.0.sdk

    (or probably iPhoneOS5.1.sdk would work, too). Then, copy that entire folder into the new Xcode 4.6 installation directory. For example:

    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs

    Afterwards, you should see this:

    iPhoneOS5.0.sdk
    iPhoneOS6.1.sdk

    With the 5.0 SDK installed, you can now build apps for the iPhone 3G, using Xcode 4.6. You can also now uninstall Xcode 4.4 if you want. See more about this in this other question. The key is that you will be building your app for armv6 (only). Armv6 is the iPhone 3G's processor.

    The second step is to turn off code-signing within Xcode. In your project settings, you set the provisioning profile to Don't Code Sign. You must modify an Xcode configuration file to allow you to do this.

    Now you build the app in Xcode. When you're done, navigate to the directory on your Mac where the app has been built (where the MyAppName.app/ folder is). Then, you use ldid to fake code sign the app executable:

    ldid -S MyAppName.app/MyAppName
    

    Now, your app has a fake code signature that will allow it to run on a jailbroken phone.

    Then, you use ssh, or scp, or something else to transfer it to your phone, where it should be installed under /Applications/.

    You already have the best link on building iOS Launch Daemons. I'd stick with that tutorial. No, I don't have any open toolchain template in Xcode, either. I just use Chris' tutorial to see how to build a non-graphical daemon main program (not a UIApplication), copy it to my MyAppName.app folder, and create a com.mycompany.mydaemon.plist file that defines the Launch Daemon.

    Once the plist is installed in /System/Library/LaunchDaemons/ on the phone, you can start it, without having to reboot the phone, with:

    launchctl load -w /System/Library/LaunchDaemons/com.mycompany.mydaemon.plist
    

    at the command line (on the phone). Or, just reboot the phone, and the daemon will start automatically.

    Although I learned to do this before it was available, you can now look at iOSOpenDev if you'd like a more polished way of doing some of this stuff.