Wednesday, September 10, 2008

XCode Template for pwned iPhone 2.0.x

This is how to skip the Provisioning Profile in order to build & go in official sdk applications (not using toolchain headers) when you are not registered iPhone developer (US$99 program).

Here is how

(1) If you have an existing project from the Official Template, you need to change the code-sign identity and add two user-defined
settings in your Project Setting as below

Info.plist:Select all

"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Pwned Developer";

There are two instances for this part to change (one for Debug and another for Release)

Then amend the Info.plist of your project
and add these
Info.plist:Select all

<string>Apple iPhone OS Application Signing</string>

Then you can build & go your project with support of debug and setting break point like other registered iPhone developer

To use this method to build & go. You need
(1) Have a fake code sign identity called "iPhone Pwned Developer" in your Mac (if you have not already done so)

Here is the nice guide from Apple to create a self-signed identity

updated link

(2) You need to patch the MobileInstallation in your iPhone (if you have not already done so)
Here is how to patch the binary in iPhone and create backup first of course (the patch program is for iPhone which I compile from the source and supports 2.0 to 2.0.2)

Shellscript:Select all

cp -p /System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation /System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation.backup
chmod +x mobileinstallation_patch
ldid -s /System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation

The updated MobileInstallation patch, please use my package as posted here

(3) You don't need to patch SpringBoard, as the changing of Info.plist has done this trick.

I have updated my XCode Template to 3.5.2

Please refer to this post for the instructions

To use the "Open Tool Chain" template you need to install the open toolchain headers, run this shell script in your Mac

$ sudo mkdir -p /Developer/SDKs/iPhoneOS.sdk/Versions/iPhoneOS2.0.sdk/
$ svn co
$ cd include-1.2-sdk
$ ./configure --prefix=/Developer/SDKs/iPhoneOS.sdk/Versions/iPhoneOS2.0.sdk/
$ sudo sh

To test the new template "View-Based Application"
Create a new project from "View-Based Application" of "Application Pwned" and modified the ViewController file and implement the loadView as below, then Build & Go to your device.

You need to have the "iPhone Pwned Developer" certifcate in your Mac plus patch of MobileInstallation in your iPhone for successful build & go

ViewController.m:Select all

- (void)loadView {
UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
self.view = contentView;
[contentView release];
self.view.autoresizesSubviews = YES;
CGRect frame = CGRectMake(10.0, 10.0, 250.0, 100.0);

UITextView *textView = [[[UITextView alloc] initWithFrame:frame] autorelease];

textView.textColor = [UIColor blackColor];
textView.font = [UIFont fontWithName:@"Arial" size:18.0];
textView.backgroundColor = [UIColor whiteColor];

textView.text = @"This is the time for Developer to port all applications to firmware 2.0";

[self.view addSubview: textView];


Important Note
The template will fail to build & go when you change your build to iPhone Simulator and then switch it back to build & go to the iPhone device.

The error message is

CodeSign error: no provisioning profiles found for code signing identity 'iPhone Pwned Developer'

If this happens, the temporary solution is to

(1) Close the project file in Xcode
(2) Use Mac terminal to change directory to the project directory and remove the temp file in project file (e.g. if the Project is called HelloWorld)

cd HelloWorld
rm HelloWorld.xcodeproj/*.pbxuser

(4) Then open the xcode project file and build and go to device again.

For Firmware 2.1 & iPhone SDK (build 9M2517) for (2.0 & 2.1 development), please search this blog for updated trick


Anonymous said...

Anyone have an idea on how to get this working with Xcode 3.1 for iPhone 2.1?

Anonymous said...

doesnt work, xcode 3.1 :X
iphone version v2.1

Anonymous said...

does this work on ipod 2.1?

Alex said...

why there is no opengl template?

Wilian Segatto said...

Thank you, thank you!!!

It works!

I downloaded the hello world from apple, added the configuration in the project and in the info.plist and it worked.

Thanks so much!

Anonymous said...

Help! doesn't exist any more! Any idea where it can be found now?

javacom said...

For MobileInstallation patch, please use my package as posted here

Alexander said...

For people who are getting to following error message:

"No provisioned iPhone OS device is connected", try one of the following:

1. Download, install and run a free application from the AppStore, possibly restart iPhone afterwards.

2. Make sure you have the matching version of the iPhone SDK to the firmware version of your iPhone

Both of these have helped me out on seperate occasions.

Anonymous said...

The new URL in the apple site that shows you how to create a new certificate is:

Thanx for your work :)

Abbreviation SMS said...

Man its nice information for every one. thank for share golden information.

Mentor PerpexLed said...

Anonymous said...

Ah, Apple made some changes for 3.0 and apparently broke this - now before the app even starts compiling, there is an error: "Code Sign error: a valid provisioning profile matching the application's Identifier 'com.yourcompany' could not be found" during the checking dependencies phase.

Anyone have ideas about how to get around this? I am fresh out of options...

Anonymous said...

Had the same problem here. I just reverted to the 2.2.1 SDK. I didn't have to remove the 3.0 SDK, just installed 2.2.1 on top of it (yeah, took a chance, YMMV, but worked for me). Can successfully build and install apps on device once again.