Preparing Devices for iPhone Development
In order to test your application on a device, you must configure your computer and your device for iPhone OS development. The following steps will show you how to get started. You can also follow these steps if you have already started and getting the code sign errors like:
- Code Sign error: The identity ‘iPhone Developer’ doesn’t match any valid certificate/private key pair in the default keychain
- Code Sign error: Provisioning profile ‘xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx’ can’t be found
Step 1 Generate a Certificate Signing Request (CSR) with a public key
- In your Applications folder, open the Utilities folder and launch Keychain Access.
- Choose Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority.
- In the Certificate Information window, enter or select the following information:
- In the User Email Address field, enter your email address
- In the Common Name field, enter your name
- In the Request is group, select the Saved to disk option
- Click Continue.
The Certificate Assistant saves a Certificate Signing Request (CSR) file to your Desktop.
The public/private key pair will be generated when you create the Certificate Signing Request (CSR) if you use the Key Chain Assistant to create the CSR.
Step 2 Submit the CSR through the Program Portal.
- Click the Development tab
- Upload the certificate by choosing the (CSR) file
- Click Submit
Refresh the page. Click on Approve (Or get your Admin to approve if you are not the team leader).
Note: If you are getting an error like – “The Certificate selected file is invalid. Please check the file and try again.” Try using Safari browser, Certificate upload has some known issues with Chrome browser.
Step 3 Adding Your Development Certificate to Your Keychain
Your development certificate must be in your keychain so that Xcode can digitally sign your iPhone applications. To add your development certificate to your keychain, in your computer:
- Once you approve the development certificate in step 2. You will see a download button in “action” tab. Download and save the development certificate (developer_identity.cer) on your computer.
- Open your development certificate with the Keychain Access application by double-clicking it or dragging it to the Keychain Access application icon.
- In the Add Certificates dialog, ensure Keychain is set to “login” and click OK.
Similarly install WWDR intermediate certificate if you haven’t already. You will see the link to download WWDR certificate (AppleWWDRCA.cer) just below the development certificate (The text reads as *If you do not have the WWDR intermediate certificate installed, click here to download now.)
To verify the successful install, you should see the following certificates in keychain:
- Apple Worldwide Developer
- iPhone Developer: <Developers name>
- Public and private keys for developer
Step 4 Register Device, Add App IDs and Create Development Provisioning Profile
More details and detailed how-to steps can be found in Device, App ID and Provisioning Tabs in the Program Portal. Just need to make sure that the App ID is same as the name of the app and while creating the provisioning file correct development certificate and devices are added.
Step 5 Installing the Development Provisioning Profile
- Download the profile developer_profile.mobileprovision
- Open Xcode and then open Organizer from Window->Organizer
- Drag the downloaded file into the ‘Organizer’ window within Xcode under iPhone Development. This will automatically copy the .mobileprovision file to the proper directory.
Step 6 Build & Install App on device
- Launch Xcode and open your project. Select ‘Device – iPhone OS’ from the ‘Device | Debug’ drop down menu.
- Select your project in Targets under the left navigation column and select the ‘Info’ icon from the top menu bar. Select the ‘Build’ Tab. Click the ‘Any iPhone OS Device’ pop-up menu below the ‘Code Signing Identity’ field and select the iPhone Development Certificate/Provisioning Profile pair you wish to sign and install your code with.
- Your iPhone Development certificate will be in bold with the Provisioning Profile associated with it in grey above.
- Build and Go