Friday, January 16, 2009

Deploying applications to IPhone

While developing my first application for the IPhone I had fun. I really enjoy Objective-C messaging style and its dynamic capabilities. The simulator was really cool provided my previous experience with other device simulators.

However I was starting to get really desperate after finding too much problems when trying to deploy (using the official and legal way) the application to the real device.

I found then an excellent post that saved me perhaps several more hours of troubleshooting.

Later I was asked to deploy the application to several other phones. This time the existence of old and new profiles, several Xcode windows opened and lack of project info updates made me lose some more time so I am documenting here what I found as a solution:

. Delete all (related to the application to be deployed) files from ""~/Library/MobileDevice/Provisioning Profiles"".
. Close Xcode and ITunes. IPhone must be disconnected from PC.
. Open Xcode
. Drag the developer and the ad hoc profiles to the Xcode dock icon
. In Xcode select Menu|Window|Organizer and expand "Provisioning Profiles" on the left pane. You must have there two profiles (dev and ad hoc)
. On the IPhone select Settings|General|Profiles and delete any previous installed profiles (at least those related to the application you are trying to deploy)
. Connect the IPhone to the PC and check the profiles (dev and add hoc) are installed using Settings|General|Profiles
. From Xcode open the project and select Menu|Build|Clean All Targets
. Click on the project root folder on the left pane and select Project|Edit Project Settings
. Navigate to Build tab and locate "Code Signing" section. click on the value for "Code Signing Entity/Any IPhone OS Device" and select the value under the Dev profile.
. Build and Go

No comments: