As a beginning developer, it is useful to play with your first app on the iOS simulator. But your enthusiasm and desire to learn more often greatly increases once you deploy the app to your iPhone. You can customize a sample project and show your friends an app they can’t get. Or you can create a utility for yourself that does something you can’t get from a free app — a flashlight with morse code anyone?
If you’ve successfully completed the tasks in my last article and you’re ready to take the next step, this article is for you. Even if you haven’t, this article details everything you need.
The basic components needed to deploy an app to your iPhone are as follows:
Prior to Xcode 4.0, you had to log on to the iOS Developer Portal to create and install these yourself. Now Xcode does almost all of this for you. Before we get started though, make sure you’ve verified that your username and password can log on to the iOS Developer Portal, because there are points where Xcode will ask for this information. Also, be aware that these instructions are for freshly configured development systems. So if you encounter some trouble along the way, refer to this article on the Apple Developer website for help.
First, we need to create the Development Certificate using the following steps:
During this process, Xcode will ask for your username and password for the Developer Account you created earlier. Then it will ask you to submit a request one or more times for a certificate.
Xcode will then ask you to Export the newly created developer profile to a file. This file can be used to recover your development certificate or to move your profile from one Mac to another. So click Export and choose a filename and password, and keep it safe.
Now let’s provision your device. Stay in the Organizer window and plug in your device. When your device appears on the left, click it. You should see a button titled “Use for Development,” which you should click. If the button is not present, just click “Add to Portal” at the bottom. This process not only registers your device, it also creates the Wildcard App ID and installs the provisioning profile on your device.
You’re now ready to deploy the sample project!
Open the attached Xcode project with File->Open if you haven’t already done so. Just to the right of the Run and Stop buttons, you should see a button labeled “hello” followed by a device name, such as “iPhone 6 Simulator”. Click this text and switch it to your iPhone or iPad.
Now, make sure your device isn’t locked, and click Run. Here, Xcode may prompt you to allow access to your Keychain (to sign the app), so click Always Allow and wait — soon your app will be running!
As with the simulator in the last article’s sample project, you should see NSLog statements appear in the Debug window, except now you may use your finger to press the button on your device and move it. No more faking it with mouse clicks!
Finally, you’re up and running! Try playing with the sample code — make changes, download other samples, or just have fun.
The provisioning profile installed on your device expires within 90 days, but may be renewed regularly through Xcode as long as you keep your developer account active. And when you’re ready to deploy an app to the App Store, you’ll have to use an App ID that is not a wildcard. This information can be found in the article referenced above and here.
Any luck or issues with this article? Please post comments below.
If this procedure helped you, please consider donating to the original developer or at least sending them a thank you.
For more of our modding, hacking, and advanced tinkering tutorials, head to our Rooting and Jailbreaking section.
For more of our tips and tricks, head to our How To section.