Thursday, June 03, 2010

My First iPhone application

Here's what I have in the (default) login keychain:
• A valid intermediate CA: "Apple Worldwide Developer Relations Cerfitication Authority"
• A valid cert named "iPhone Developer: FirstName LastName" issued by the aforementioned CA
• A RSA 2048-bit private and public key, each named "FirstName iPhone Dev Key"
The keychain application is available through Application/Utilities/Keychain.app.
Once your certificate has been deployed you should see under My Certificate something like iPhone Developer: FirstName LastName.
So far, so good. Meanwhile, on the Program Portal, you need to:
• Registered your iPod touch
• Add an App ID (com.mycompany.myapp). I usually create one for each app keeping the com.mycompany the same.
• Create a Development Provisioning Profile for the aforementioned App ID, device and certificate.

A Provisioning Profile is a collection of digital entities that uniquely ties developers and devices to an authorized iPhone Development Team and enables a device to be used for testing. A Development Provisioning Profile must be installed on each device on which you wish to run your application code. Each Development Provisioning Profile will contain a set of iPhone Development Certificates, Unique Device Identifiers and an App ID.

Devices specified within the provisioning profile can be used for testing only by those individuals whose iPhone Development Certificates are included in the profile. A single device can contain multiple provisioning profiles.

Click here to access the Developer Portal and then
click on iPhone Provisioning Portal on the top right corner.
In the ‘Provisioning’ section of the Portal, click on iPhone Provisioning Portal. Team Admins should click 'Add' on the Development tab. Enter a name for the provisioning profile.
Specify which devices will be associated with the provisioning profile. You must specify a device in order for that device to utilize the provisioning profile. If a device's UDID is not included in the provisioning profile the profile and your application cannot be installed on that device.
Specify which iPhone Development Certificates will be associated with the provisioning profile. You must specify an iPhone Development Certificate in order for the application code signed with that same certificate to run on the device.
Specify a single App ID for the Development Provisioning Profile. Each Development Provisioning Profile can specify only ONE App ID, therefore, if you have applications requiring different Keychain access, you will need to create a separate Development Provisioning Profile for each of those applications. If you are installing a suite of applications with the same required Keychain access or have a set of applications not requiring access to the Keychain, use an App ID containing the wild-card asterisk character to build all of your applications.
Click ‘Submit’ to generate your Development Provisioning Profile.

NOTE: On the Portal, the Certificate only shows as "FirstName LastName" and not "iPhone Developer: FirstName LastName".

Installing a Development Provisioning Profile
All Team Agents, Admins and Members can download a Development Provisioning Profile from the ‘Provisioning’ section of the Portal after it has been created. Only those developers whose Apple device IDs and iPhone Development Certificates are included in the provisioning profile will be able to install and test their application on their device.

In the ‘Provisioning’ section of the Provisioning Portal, click the download button next to the desired provisioning profile.
Drag the downloaded file onto the Xcode application icon in the dock or into the ‘Organizer’ window within Xcode. This will automatically copy the .mobileprovision file to the proper directory. Alternatively, you can drag the .mobileprovision file onto the iTunes icon in the dock or copy the file to ‘~/Library/MobileDevice/Provisioning Profiles’. If the directory does not exist you will need to create it. Click on the ‘+’ button in the Provisioning section of the Organizer window to install your .mobileprovision file.
I recommend to create the Library/MobileDevice/Provisioning Profiles else after each download you will end up with all provisioning profile under you Download Folder.

Now, on to the home stretch! In Xcode 2.2.1, you must have:
• REMOVED my build directory (before launching Xcode with said project - OPTIONAL) or just perform a full project clean using XCode for the project in question .
• Docked/synced your iPod touch
• Dragged-and-dropped your downloaded provisioning profile into the appropriate spot in the Organizer. It's not grayed out, and the profile is also in your Library in the expected location.
• Chosen "iPhone Device 2.2.1" as the active SDK.
• Under Targets, select your app, then picked Get Info.
• Under the Build tab, verified Base SDK is set to "iPhone Device 2.2.1". For Code Signing Identity, Any iPhone OS Device, there is a value of "iPhone Developer" - fine.
• Under the Properties tab (right click on Targets then select Get Info, change the Identifier to match my App ID com.mycompany.myappid. Be careful not to add any extra leading space by mistakes (EG copy past from the web) Xcode is too stupid to remove spaces.... lame...

No comments: