Howto: iPhone Application Development Environment

fc2f4d5ef6ece7edcfba3ef5d817904f

After a lot of frustrations I finally figured out how to setup my mac ( the certificates, mobile provisioning files.. ) for developing native iPhone Apps. Without re-creating the certificates and provisioning profiles everytime you start a new project.

In this post I’ll write about how I’ve configured my development environment for building native iPhone Apps in this blogpost.

Creating the certificates

Certificate Signing Request

Launch the ‘Keychain Access’ application on your mac under Applications > Utilities, and make sure that under Preferences Online Certificate Status Protocol (OSCP) and Certificate Revocation List (CRL) are set to ‘Off’.

Choose Keychain Access -> Certificate Assistant -> Request a Certificate from a Certificate Authority, make sure you don’t choose ‘Request a Certificate from a Certificate Authority with ‘ !!

For ‘User Email Address’ and ‘Common Name’ fill in the same information you’ve registered your iPhone developer account with. ‘CA Email Address’ can be left blank.

Choose ‘Saved to Disk’ for the Request, and select ‘Let me specify key pair information’.

Click Continue.

Select a filename and location where the certificate should be saved.

Click Continue.

For ‘Key Size’ select ’2048 bits’ and for ‘Algorithm’ select ‘RSA’.

Click Continue.

The Certificate Signing Request file will be saved on the location you’ve selected earlyer.

You can close the Keychain Access application, and return to the iPhone Developers portal.

Now we have to upload the Certificate Signing Request file for approval. Open the iPhone Developers portal and login with your account.

Chose ‘Add Certificate’ from Certificates > Development.

Select the file you want to upload and click ‘Submit’.

When the file is successfully uploaded you’ll get the message: “The Certificate Request has been submitted for approval”.
The certificate is now wayting for approval, scroll down and click ‘Approve’ for the right certificate.

Next it will be ‘Pending Issuance’. While waiting you can download and install the WWDR Intermediate Certificate, you need this certificate for development.

Now reload the ‘Current Development Certificates’ page, and download and install the generated certificate.

Add Devices

Add iPhone/iPod devices to your account.

Select ‘Add Device’ from Devices > Manage, and add upto 100 devices you want to use for development testing and Ad Hoc distribution.
Device ID’s can be found from iTunes and/or Xcode.

Creating an AppID

Next we’re going to create an generic ( wildcard ) App ID to be used with the provisioning profiles.

Select ‘Add ID’ from ‘App IDs’, fill in a generic name ( e.g. ‘Yourcompany’ ) and a wildcard bundle identifier ( e.g. ‘com.yourcompany.*’ ).
The ‘.*’ at the end is the wildcard, needed so that you only need one set of provisioning profiles for all your applications.

Click Submit.

Creating the provisioning profiles

Click ‘Add Profile’ from Provisioning > Development.

Choose a name for your development provisioning profile, this name will be shown in XCode when selecting codesign profiles.

Select the certificates, choose the App ID and select the Devices this profile applies on.

Click Submit.

Your development provisioning profile will now be generated.
Reload the page after a few moments to check if generation is done, download the profile and drag it into iTunes or XCode to instal it.
Or copy it manualy to “~/Library/MobileDevices/Provisioning Profiles”

Now we’re done and ready for development.
For Distribution (Ad Hoc and App Store) certificates and provisioning profiles you have to create a new Certificate Signing Request, upload it under Certificates > Distribution, download and install it.

Add 2 profiles from Provisioning > Distribution, one for Ad Hoc and one for App Store.
What to do and fill in should be clear.. we’ve done it before for development.

XCode project settings

Startup XCode and create a new iPhone project, I always start with a Window-Based Application.

Create a new file named ‘Entitlements.plist’ with the following content and place it in your project root (where Info.plist is)

1
2
    <key>get-task-allow</key>
    <true/>

Select “Edit Project Settings” from Projects, select the build tab and open the configuration for debug.

Under “Code Signing” fill in ‘iPhone Developer: ‘ for Code Signing Identity, and for Code Signing Provisioning Profile your generated development profile should show up, select it.

Do the same for Release.

Select ‘Edit Configurations’

Duplicate the Release configuration and name it ‘Distribution’, select the build tab and select Distribution from the Configuration dropdown.

For Code Signing Entitlements fill in ‘Entitlements.plist’ ( we’ll create this file later ), for Code Signing Identity fill in ‘iPhone Distribution: ‘ and for Code Signing Provisioning Profile select your generated Ad Hoc distribution profile.

Go back to ‘Edit Configutations’ and duplicate the Distribution configuration and name it AppStore.

Select the build tab, and choose the AppStore configuration from the configurations dropdown.

For the Code Signing Provisioning Profile, select your generated AppStore profile.

Close the project settings window.

Edit ‘Info.plist’ and fill in for ‘Bundle Identifier’ the Bundle ID you’ve used to generate the provisioning profiles ( e.d. ‘com.yourcompany.HelloWorld’ if your application’s name is ‘Hello World’ )

Note: Sometimes the provisioning profiles don’t show up directly. Sometimes a restart of XCode might help.

Now we’re all set to start developing our next killer iPhone App!!

Please leave comments when I’m wrong somewhere… this all worked fine for me.

Tags: ,