Well, everything worked for you in the simulator, now you got a device and you are going to put it to test.
Before we move too fast, a few things to understand:
- As of date, one does not have to buy a device to download the iPhone sdk. You can always go to the link http://developer.apple.com/programs/register/ and register as a Apple developer for free. You will get an Apple ID and you can download the sdk.
- And then create your project in Xcode (btw, Xcode is not preinstalled, if you bought a new machine, you can install it from the installation CD, and upgrade the version from the iOS Dev Center athttp://developer.apple.com/devcenter/ios/index.action) and set your target as the Simulator and learn iPhone programming to your hearts content.
- However, for serious debugging and testing before releasing to customers, it is advisable to use the actual device, as features like the Accelerometer, Memory, Performance, Camera and GPS can be tested. I do not know whether there is a 3rd party software to do that for the iPhone (like there is atleast one for the Android). However, Simulators are just that, they cannot guarantee 100% compatibility. They are best used for checking resolutions over various iPhone versions (and multiple devices in case of Android).
Given that it is necessary to test with a Device and distribute your app to the App Store, and since Apple does not provide this for free. One has to join the iOS Developer program (http://developer.apple.com/programs/ios/ ) which is $99 for individuals.
Go to iOS Dev Center main page at http://developer.apple.com/devcenter/ios/index.action, and click on iOS Provisioning Portal link on the right hand column or go directly tohttp://developer.apple.com/ios/manage/overview/index.action
Follow the steps on the Right hand column.
Obtain your certificates (Both Developer and Distribution certificates)
- Download and double click on them, you should be able to see them in your Keychain Access utility (Keychain Access utility is available in Applications->Utilities
- You can assign only 100/account, deassigning wont reduce the count, so be careful about assigning Device Ids in your provisioning profile for testing purposes)
- You need to go to Xcode->Window->Organizer and click on the option that suggests that the USB connected device is the device you need for using for development on that particular computer
Create your App IDs
NOTE: App ID (the application identifier – your unique app) is not your Apple ID ( along with the password, is used to identify you by Apple.)
- Ex: let us say your company is CoolApps. Enter ‘CoolApps App ID’ in the description (this is just a guide, you can enter whatever you want!)
- Enter the reverse dns for your company – com.coolapps.* in the Bundle Identifier portion
- App ID is a combination of BundleSeed and Bundle Identifier. BundleSeed is created by Apple and given to you, so you have no control over that.
- The default App ID is a wildcard one .* (It is associated with your default created ‘Team Provisioning Profile in the later section.).
Create Provisioning Profiles
- By default ‘Team provisioning Profile: * , i.e is already created with the Wildcard App ID and available to you, which is all that is needed for you to Develop, but you will get into problem when you try to Distribute you app, which has to have files in the com.coolapps.* format and not just a mix of com.sample1., com.sample2. and com.coolapps.*.
- Create another development profile (Highly recommended) e.g CoolApps Development Profile – which is created with the App ID in the reverse dns format.
- Create a Distribution profile e.g CoolApps Distribution Profile – which is created with the App ID in the reverse dns format.
- At this Stage, In the Provisioning portal, all Provisioning profiles should be ‘active’ and all device status should be showing ‘installed’
Going for the Build to deploy your app on your Development Device
- In Xcode , change from Simulator to Device (in the dropdown at the top of the Xcode window), so that your target for application deployment will be the Device.
- The default ID which is a wild card ID is like a catch all iD, when associated in Code Signing (if you are using sample files to build, they will most obviously not have com.coolapps.appfile imports, in which case without the ‘Team Provisioning profile’, your build would fail. So you would want to set this in your
- Xcode->Project ->Edit Project Settings->Build (tab)->Code Signing Identity (header) ->Any iOS (change from Any iOS Simulator)->(select ‘iPhone Developer’ as value and it will default to the wildcard development provisioning profile (Team Provisioning Profile: * )
and also (VERY IMPORTANT)
- Xcode->Project ->Edit Active Target ->Build (tab)->Code Signing Identity (header) ->Any iOS (change from Any iOS Simulator)->(select ‘iPhone Developer’ as value and it will default to the wildcard development provisioning profile (Team Provisioning Profile: * )
- You might want to change the reverse dns by editing info.plist in your project (if you are using sample projects to customize your project. (This is not needed for error free build – but an important consideration nevertheless!).
Testing with the Development profile that you created will help you when you move to distribute the App and build with the Distribution profile which also has AppID in the reverse dns format
I’m assuming that you had this project working with the iOS simulator – Click on Build and Run
VOILA! – You MUST not get any Code Sign error and your application MUST be deployed to the Device.