How to Deploy App to iOS Device using XCode

On November 25, 2011, in Mobile, by Anuj Gakhar

In this post, I will be talking about the steps involved in deploying your PhoneGap app to your iOS device using XCode. Bear in mind that if you only want to test your app functionality, you can do so in the iOS Simulator available within XCode. However, for whatever reason, if you want to actually test your app on the actual device, you need to generate a .ipa file and a mobile provisioning profile. To be able to create a provisioning profile, you need to enroll to the Apple iOS Developer Program (costs $99/year or £59/year if you are in the UK). In this post, I won’t be going into the details of how to create a provisioning profile using Apple’s iOS Provisioning Portal – I will assume you already have a provisioning profile. So, let’s get started.

Connect your iOS device to your computer

Once you do this, you will notice that the list of devices in the top left will now show up your connected device as well, apart from all the simulators.

Create an Archive

You will notice that once you select your device in the list above, the “Product -> Archive” menu item will be enabled (it is disabled if you have any of the simulators selected). Hit the “Archive” menu item and XCode will then sign your archive using the certificate in your keychain and create an archive file. The file will be named something like PhoneGapTest 24-11-2011 22.32.xcarchive.

Share the Archive

Once you have created the Archive, you need to go to the Archives Section in the XCode Organizer window, select your archive and then hit “Share”.

Create the .ipa

Now you will get the option to create an .ipa (iOS App Store Package) and your provisioning profile will automatically be selected in the dropdown. If not, you can choose the one that applies to this app.

Use iTunes to copy to device

At this point, you can select where you want to store your .ipa file. Once this is done, you can now drag/drop you .ipa to iTunes and then your provisioning profile (.mobileprovision file) as well, Once that is done, iTunes will copy the app to your device. Or you can manually hit “Sync” to do that if iTunes does not do it automatically.

I know this is not a very straight forward process as compared to copying an app to an Android device e.g. but I think Apple just wants to know about each and every device that is being used for development (by asking for the device UUID in the provisioning profile creation process).

I am learning all these processes as part of my mobile development journey and I will be posting such information here as and when I find something worth blogging.

P.S. I have used XCode 4.2.1 and PhoneGap 1.2 in the above example

Tagged with:  

7 Responses to How to Deploy App to iOS Device using XCode

  1. Lucas says:

    Great post. Thanks

  2. Someone says:

    Great, that was exactly what I needed 🙂
    The “how to” for provisioning profiles on the apple developer page https://developer.apple.com/ios/manage/provisioningprofiles/howto.action isn’t suitable for xCode 4.2.1!

    • Ivania says:

      Hi, I tried the Gizmodo method of upargding without a dev center account, but can’t get the phone activated I was going to email you about asking to add my UUID to your dev center acct but I can not get the UUID now through Itunes because it is stuck at the screen we are unable to complete your activation . Can you tell me a) how to get the UUID and b) if you can still add me to your list /can I still pay?Thanks. I am totally useless on this phone rught now.Laura

  3. CHINMAY GADGIL says:

    Great post better than on aaple-developers site,can you explain what does provisioning profile exactly do or why do we need to create it?

  4. CHINMAY GADGIL says:

    I am able to transfer my app on my device but it crashes,i have no idea why is it happening and neither i am able to create its ipa file as i don’t have any provisioning profile,can you plz help me with it??

  5. tre says:

    Thanks for the article, it helps for beginning iOS programming.

  6. Rodge says:

    I do this the easy way: just drag the .app file which is created by “Project / Build for / Testing” to the “Applications” section in Organizer (under my device).

    Any comments on this?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 446 other subscribers

© 2011 Anuj Gakhar
%d bloggers like this: