Yesterday, I took some time off from the nice weather and gardening tasks to go out and get a new iPhone 3GS. First off, let me say that the speed difference is really great! I've only played around with a few of the new features (such as the video camera and compass), but the speed increase is a huge plus. Today, I got around to creating a new developer profile for my new iPhone 3GS. My old iPhone was having some problems a few months ago and Apple replaced it, so I remembered the hassles I had then setting up a new provisioning profile for the replacement device (this seems to be a common iPhone developer complaint). I had similar problems this time with the 3GS, so I've decided to note down all the things that I did to get it setup properly. Hopefully, this will help someone else (or, at least, it might remind me of the necessary steps the next time I have to do it!). Not all these steps may be necessary (and it's probably a lot easier if you're just adding a device to an existing profile rather than replacing a provisioning profile); however, I wanted to make sure I knew all the steps this time and it's what worked for me!
When you upgrade to a new device, you need to do the following:
In Apple's iPhone Developer Program Program Portal:
- Create a new provisioning profile for the device
- Set up a new device profile
- Download the new provisioning profile to the Desktop
On the Mac:
- Delete the old provisioning profile from ~/Library/MobileDevice/Provisioning Profiles/
- Drag the new provisioning profile from the Desktop into ~/Library/MobileDevice/Provisioning Profiles/
In the Organizer window in Xcode:
- Click on the device (in the left-hand pane)
- Drag the new provisioning profile into the "Provisioning" box
- Click on the "Provisioning Profiles" (in the left-hand pane)
- Double-click on the new profile name (in the top pane) - it should appear in the "Included Devices" bottom pane with an "Installed" status
- Close the Organizer window
- Press the Xcode/Empty Caches... menu option
- Close Xcode
On the Mac and iPhone:
- Power off both the Mac and the iPhone
- Power on both the Mac and the iPhone
- Attach the iPhone to the Mac
For each project you previously built with the old provisioning profile:
- Right-click on the [projectname].xcodeproj file and select "Show Package Contents"
- Make a backup copy of the project.pbxproj file
- Use a text editor (I used Emacs) to edit the project.pbxproj file:
- Delete any lines that have the key CODE_SIGN_IDENTITY
- Delete any lines that have the key PROVISIONING_PROFILE
- Delete any lines that have the key "CODE_SIGN_IDENTITY[sdk=iphoneos*]"
- Delete any lines that have the key "PROVISIONING_PROFILE[sdk=iphoneos*]"
In Xcode, for each project you previously built with the old provisioning profile:
- Open the project
- Press the Build/Clean All Targets menu option
- Press the Project/Edit Project Settings menu option
- On the Build tab under "All Configurations", chage the "Code Signing Identity" value to iPhone Developer
- On the Xcode dropdown menu, select to build on the Device
- Press the Build/Build and Run menu option (the application should build and load on the device)
That's what worked for me. If anyone has an easier/alternative approach, let me know and I'll publish relevant comments in updates to this post.