Becoming a registered Apple iPhone Developer can be a long process, you need to wait for Apple’s evaluation which may take a long time specially if you are outside the US. This makes it really frustrating to wait to get your iPhone application installed on your phone. When I faced this myself I had to do some research on how to install my application on my iPhone using a third-party installer called Cydia, and here’s how I ended up doing it.
This tutorial expects you already built your application, you have a bricked/unlocked iPhone with Cydia installed and you don’t have an Apple iPhone Developer license.
If you are a registered iPhone developer getting the application on your iPhone is as simple as compiling it directly to the device and you’re all set. If you’re not, you’ll need to go over a long process starts with obtaining a Code Signing identity, compiling the application to device profile, packaging it as a Debian package and finally hosting it on a Cydia online repository.
Code Signing and building for device
In order to install an iPhone application on your phone you have to first compile it for the device. you can do that from Xcode by setting the Active SDK to Device instead of Simulator. Go to Project > Set Active SDK > Device - iPhone OS 2.2 (Project Setting).
If you try to compile now you’ll get the following error “CodeSign error: Code Signing Identity ‘iPhone Developer’ does not match any code-signing certificate in your keychain. Once added to the keychain, touch a file or clean the project to continue.” and that’s because Xcode expects a code signing certificate to be installed on your system.
But that’s not a big issue, you can create an untrusted code signing certificate yourself following the steps mentioned on Apple website.
- Open Applications > Utilities > Keychain Access.
- From the Keychain Access menu, choose Certificate Assistant > Create a Certificate.
- Use the name iPhone Developer as the name of your certificate.
- Choose Self Signed Root from the Type popup menu.
- Check the Let me override defaults checkbox. Click Continue.
- Select a serial number for the certificate, normally if this is your first Code Signing certificate you should be fine with the default Serial Number of 1.
- Choose Code Signing from the Certificate Type. Click Continue.
- Fill in the information for the certificate. Click Continue.
- Accept the defaults for the rest of the dialogs.
Trying to compile again now (you may need to restart Xcode), you’ll receive another error message “CodeSign error: a valid provisioning profile is required for product type ‘Application’ in SDK’ Device - iPhone OS 2.2′” asking for provisioned (trusted) certificate.
To bypass that you’ll need to edit your Xcode configuration file in /Developer/Platforms/iPhoneOS.platform/Info.plist by adding the bold lines below inline (via iPhone Software Development):
<key>NATIVE_ARCH</key>
<string>armv6</string>
<key>PLIST_FILE_OUTPUT_FORMAT</key>
<string>binary</string>
<key>PROVISIONING_PROFILE_ALLOWED</key>
<string>NO</string>
<key>PROVISIONING_PROFILE_REQUIRED</key>
<string>NO</string>
<key>SDKROOT</key>
<string>iphoneos2.2</string>
For 2.2.1 SDK update the same file but with the following instead (again only the bold lines):
<key>OverrideProperties</key>
<dict>
<key>CODE_SIGN_CONTEXT_CLASS</key>
<string>XCiPhoneOSCodeSignContext</string>
<key>DEBUG_INFORMATION_FORMAT</key>
<string>dwarf-with-dsym</string>
<key>EMBEDDED_PROFILE_NAME</key>
<string>embedded.mobileprovision</string>
<key>SDKROOT</key>
<string>iphoneos2.2.1</string>
<key>PROVISIONING_PROFILE_ALLOWED</key>
<string>NO</string>
</dict>
Restart Xcode and try again, you will be able to compile and build your application for the phone now. The next step is to package it and make it ready for Cydia to install it on the iPhone.
Preparing The Package
Cydia basically is a graphical interface for debian package installer on the iPhone, so first you’ll need to have a unlocked/jailbroken phone, with Cydia installed on it. If you don’t have an unlocked/jailbroken phone you can do that using QuickPwn.
Now with Cydia installed we need to prepare your application as a Debian package, and create a source repository for Cydia to download your application from.
To create a Debian package on Mac OS X we’ll need some Debian tools like dpkg-deb and dpkg-scanpackages which don’t come in Mac OS X. To get those tools we have to Fink.
After installing Fink on your computer, create the following folder structure for your application:
The MyProgram.app file is the compiled for device build available in MyProgram/build/Debug-iphones/ or MyProgram/build/Release-iphones, the control file is a configuration file for your application, it contains the package information, here’s an example control file:
Package: com.yourdomain.myprogram Name: MyProgram Version: 1.0.4-1 Architecture: iphoneos-arm Description: A small description Homepage: http://www.yourdomain.com/more_info_about_package_for_cydia Depiction: http://www.yourdomain.com/even_more_info Maintainer: Your Name <you@example.com> Author: Developer/Your Name (nickname) <you@example.com> Sponsor: Company Name <http://www.companydomain.com> Section: Application Section </http://www.companydomain.com></you@example.com></you@example.com>
Here is a little explanation for some of the sections above (from Jay Freeman (saurik) website, full explanation can be there):
- Version: A package’s version indicates two separate values: the version of the software in the package, and the version of the package itself. These version numbers are separated by a hyphen.
- Homepage: Often, there is more information that a packager wants to provide about a package than can be listed in the description of the package. Cydia supports a “More Info” field on the details screen that shunts users off to a website of the packager’s choice.
- Depiction: Pretty much the entire interface of Cydia is a webpage, which makes adding features or new functionality remotely very easy. One thing you might want is to be able to display custom links or screenshots with special formatting… just plain something special (even an advertisement) on your package page. This is done with a “depiction”, which is a URL that is loaded into an iframe, replacing the Description: and Homepage: links that are normally presnt. For a good example see WinterBoard’s package details page in Cydia. For many packagers this has simply become their More Information page, which is only used for backwards compatibility. It does not need to be the same, however. You also may consider not having a Homepage: field at all if you include Depiction:.
- Maintainer: The person who built the package is called the “maintainer”. This is the person who will be contacted with issues relating to the package itself. This should be of the form “their name <email@addre.ss>“.</email@addre.ss>
- Author: In contrast, the person who wrote the original software is called the “author”. This name will be shown underneath the name of the package on the details screen. The field is in the same format as “Maintainer”.
- Sponsor: Finally, there might be someone who is simply providing the influence or the cash to make the package happen. This person should be listed here in the form of “Maintainer” except using a resource URI instead of an e-mail address.
- Section: Under the “Install” tab in Cydia, packages are listed by “Section”. If you would like to encode a space into your section name, use an underscore (Cydia will automatically convert these.
Packaging and Indexing
Now that we have the folder structure ready let’s package it, fun the following from the Terminal from your the directory you’re holding the above folder structure in:
username@computername:~/projects/MyProgram/Cydia$ ls -l total 0 drwxrwxrwx 5 rbarazi rbarazi 170 Feb 13 23:46 MyProgram username@computername:~/projects/MyProgram/Cydia$ dpkg-deb -d MyProgram warning, 'MyProgram/DEBIAN/control' contains user-defined field 'Name' warning, 'MyProgram/DEBIAN/control' contains user-defined field 'Homepage' warning, 'MyProgram/DEBIAN/control' contains user-defined field 'Depiction' warning, 'MyProgram/DEBIAN/control' contains user-defined field 'Author' warning, 'MyProgram/DEBIAN/control' contains user-defined field 'Sponsor' dpkg-deb: building package 'com.yourdomain.myprogram' in 'MyProgram.deb'. dpkg-deb: ignoring 5 warnings about the control file(s) username@computername:~/projects/MyProgram/Cydia$ ls -l total 24 drwxrwxrwx 5 rbarazi rbarazi 170 Feb 13 23:46 MyProgram -rw-r--r-- 1 rbarazi rbarazi 9190 Feb 14 00:20 MyProgram.deb
This will generate a Debian package called MyProgram.deb, now we need to make it available for Cydia to download and install on the phone. To do that we need a web folder, the package we created and a packages index file.
To generate the packages index file we’ll use another tool called dpkg-scanpackages (also from the Terminal):
username@computername:~/projects/MyProgram/Cydia$ dpkg-scanpackages . /dev/null > Packages ** Packages in archive but missing from override file: ** com.yourdomain.myprogram Wrote 1 entries to output Packages file. username@computername:~/projects/MyProgram/Cydia$ bzip2 Packages username@computername:~/projects/MyProgram/Cydia$ ls -l total 32 drwxrwxrwx 5 rbarazi rbarazi 170 Feb 13 23:46 MyProgram -rw-r--r-- 1 rbarazi rbarazi 9190 Feb 14 00:20 MyProgram.deb -rw-r--r-- 1 rbarazi rbarazi 371 Feb 14 00:23 Packages.bz2
Now you’ve got the Packages.bz2 index file and the Debian package MyProgram.deb, upload both to your web server, for example I uploaded mine to http://ridaalbarazi.com/iphone
Installing the application
From Cydia go to Manage > Sources > Edit > Add and add the URL of your online repository there. Cydia will automatically show your package, install it and enjoy having your application on your iPhone.
Additional Resources
- Code Signing Guide: Obtaining a Signing Identity
- Bypassing iPhone Code Signatures
- Using XCode with Pwned iPhone
- How to skip provisioning profile for iPhone SDK 2.2
- How to skip provisioning profile for iPhone SDK 2.2.1
- How to Host Cydia Repository
- Running your own iPhone applications without paying the developer fee
- How To Add A Source In Cydia
Chargement ...






