Running apps on the simulator is useful, but it is not a substitute for running them on a hardware device. Hardware devices have additional capabilities (cameras, for example) and the performance of apps can vary between the simulator and a hardware device.
You will need an Apple Developer Program account to run apps on a device and submit apps to the App Store. A free account will allow you to run on a device, but you will not be able to submit apps to the App Store without a paid account. You can enroll in the Apple Developer Program at developer.apple.com/programs/enroll/.
There are four important items in the provisioning process:
When an application is deployed to a device, Xcode uses a provisioning profile on your computer to access the appropriate certificate. This certificate is used to sign the application binary. Then, the development device’s UDID is matched to one of the UDIDs contained within the provisioning profile, and the App ID is matched to the bundle identifier. The signed binary is then sent to your development device, where it is confirmed by the same provisioning profile on the device and, finally, launched.
Managing these details yourself can be complicated, but thankfully Xcode can manage it all for you.
After you have registered for a developer account, you need to add the account to Xcode. Open Xcode and select Xcode → Preferences. Select the Accounts tab and click the button in the bottom-left corner. Choose Apple ID and then sign in to your developer account. Once you are done, you will see your account listed on the lefthand side (Figure 1.31).
Close the preferences window. Select the Quiz project in the project navigator, select the Quiz target, and then open the Signing & Capabilities pane. Make sure the Automatically manage signing checkbox is checked. Then, from the Team drop-down menu, select your developer account.
Plug in your device. You will be prompted on the device to trust your computer. Once you have done that, select the device from the active scheme pop-up menu (Figure 1.32); it should be at or near the top of the choices.
Back in the Signing & Capabilities pane, you will be asked to register the device to your developer account. Click Register Device, and Xcode will take care of the details. Once that is complete, your Signing & Capabilities pane will look similar to Figure 1.33.
At this point, you can build and run your application (Command-R), and it will appear on your device.