Saturday, June 20, 2009

Use XCode 3.1.2 to build SDK 3.0 app to 3.0 Device without provisioning profile

The trick to skip Provisioning Profile for the new XCode 3.1.3 (iPhone SDK3.0) does not work now. The only thing you can do is to use the old XCode 3.1.2 <Old XCode Dir> to build app for 3.0 device if you don't have the official provisioning profile, until new method to skip provisioning profile can be found.

What you need is to install the new iPhone SDK 3.0 (XCode 3.1.3) in a new directory (non-default dir) <New XCode Dir> and copy the SDK3.0 and the necessary device support files to XCode 3.1.2 and use it build app to 3.0 device.

You need to do the followings:

(1) Create a symbolic link from <New XCode Dir>/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk
to <Old XCode Dir>/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/

(2) Create a symbolic link from <New XCode Dir>/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0 (7A341)
to <Old XCode Dir>Developer/Platforms/iPhoneOS.platform/DeviceSupport/

(3) Backup the folder of <Old XCode Dir>/Developer/Platforms/iPhoneOS.platform/Developer/usr

(4) Replace the folder of <Old XCode Dir>/Developer/Platforms/iPhoneOS.platform/Developer/usr
by <New XCode Dir>/Developer/Platforms/iPhoneOS.platform/Developer/usr

(5) Edit the <Old XCode Dir>/Developer/Platforms/iPhoneOS.platform/Info.plist to have the magic keys, may be you have already done so. You can refer to this for instruction.

Info.plist:Select all

<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>
<key>PROVISIONING_PROFILE_REQUIRED</key>
<string>NO</string>

</dict>


(6) Create a self signed identity say "iPhone Pwned Developer" in your Mac (you probably have this already) see Apple Guide here

(7) Remember to restart Xcode (your old Xcode 3.1.2)

(8) Install the Installd Patch for OS 3.0 to your 3.0 device. This package is in Tweaks Section from the Cydia Source http://iphone.org.hk/apt/ which is released by me. Please reboot device after installation of this package.

(9) Create New Project in in XCode 3.1.2 and in Info.plist, add the magic key of SignerIdentity, you probably know this already. (update, you don't need this after installd patch and for OS 3.0 or above)

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


(10) Use the codesign identity as created in step 6 above to codesign the binary and Build and Go to 3.0 device

P. S. I did not copy the Simulator SDK 3.0, because I can use the iPhone SDK 3.0 in <New XCode Dir> to test 3.0 Simulator. If you want to update the documentation in your old XCode, it is in <New XCode Dir>/Developer/Platforms/iPhoneOS.platform/Developer/Documentation

You can use move instead of symbolic link, if you want to uninstall the <New XCode Dir>


For those who wants to get the iPhone SDK 2.2.1 (XCode 3.1.2) , try the direct download link here (you need to login your developer account)

iPhone SDK 2.2.1 direct download link
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_for_iphone_os_2.2.1__9m2621a__final/iphone_sdk_for_iphone_os_2.2.19m2621afinal.dmg

iPhone SDK 2.2 direct download link
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_for_iphone_os_2.2__9m2621__final/iphone_sdk_for_iphone_os_2.2_9m2621_final.dmg


iPhone SDK 3.0 (Xcode 3.1.3) Leopard direct download link
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.0__final/iphone_sdk_3.0__leopard__9m2736__final.dmg

iPhone SDK 3.0 (Xcode 3.2) Snow Leopard direct download link
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.0__final/iphone_sdk_3.0__snow_leopard__final.dmg


iPhone SDK 3.1 with Xcode 3.1.4 Leopard direct download link
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1__final/iphone_sdk_3.1_with_xcode_3.1_final__leopard__9m2809.dmg

iPhone SDK 3.1 with XCode 3.2.1 for Snow Leopard
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1__final/iphone_sdk_3.1_with_xcode_3.2_final__snow_leopard__10a432.dmg

iPhone SDK 3.1.2 with XCode 3.1.4 for Leopard
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1.2__final/iphone_sdk_3.1.2_with_xcode_3.1.4__leopard__9m2809.dmg

iPhone SDK 3.1.2 with XCode 3.2.1 for Snow Leopard
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1.2__final/iphone_sdk_3.1.2_with_xcode_3.2.1__snow_leopard__10m2003.dmg

iPhone SDK 3.1.3 with XCode 3.1.4 for Leopard
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1.3__final/iphone_sdk_3.1.3_with_xcode_3.1.4__leopard__9m2809a.dmg

iPhone SDK 3.1.3 with XCode 3.2.1 for Snow Leopard
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1.3__final/iphone_sdk_3.1.3_with_xcode_3.2.1__snow_leopard__10m2003a.dmg

iPhone SDK 3.2 beta 4 with Xcode 3.2.2 (Snow Leopard)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.2_beta_4/iphone_sdk_3.2_beta_4_with_xcode_3.2.2.dmg

iPhone SDK 3.2 with Xcode 3.2.2 (Snow Leopard)
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.2__final/xcode_3.2.2_and_iphone_sdk_3.2_final.dmg

Updates: use this script to patch "iPhoneOS\ Build\ System\ Support". If you think the use of dd utility is fragile, don't use it.

patch.sh Select all

#!/bin/bash
cd /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneOS\ Build\ System\ Support.xcplugin/Contents/MacOS/

dd if=iPhoneOS\ Build\ System\ Support of=working bs=500 count=255
printf "\x8f\x2a\x00\x00" >> working
dd if=iPhoneOS\ Build\ System\ Support of=working bs=1 skip=127504 seek=127504
/bin/mv -n iPhoneOS\ Build\ System\ Support iPhoneOS\ Build\ System\ Support.original
/bin/mv working iPhoneOS\ Build\ System\ Support
chmod a+x iPhoneOS\ Build\ System\ Support



Enjoy.
.
.
.