Thursday, December 23, 2010

Distributing iPhone applications Ad Hoc way for testing

There are thousand of sites describing process of creating provision profile for distributing iPhone app to beta testers but you will still get stuck at some point in process.
If you are using any hybrid frame works like phoneGap/Titanium developer/etc, it gets more complicated.
Here are some basic steps to distribute your iPhone app on friends and colleagues devices.
Prerequisite:
  • Access to iOS provision portal via Apple developer account ($99)
  • Development certificate – Best documentation is available on apple site.
  • App ID – make sure your app id in xcode or titanium developer is same as prov. portal app id.
  • Device ID’s already defined in “Devices” section of prov. Portal
You can get device ID using iTunes or installing app on device.

If you have developer profile already created then you will have all of above items, developer profile is different than Ad Hoc distribution profile, Developer profile will allow you to test device by connecting to mac and deploy your app but wont be helpful if you want to deploy on remote devices.

To do beta testing of your app on other devices you will need Ad Hoc distribution profile.

  • Create Ad Hoc distribution profile:
    Make sure to select Ad hoc as distribution method and select all the devices you want to install app on. 
     

  • Download .mobileprovision file from download option. 

  • Drag and drop profile on xcode icon or xcode-organizer window

     
  • Setup up xcode project:For titanium developer: do not use titanium developer to build project since version 1.2.x does not have option to build app with Ad hoc provision, you can build app using xcode project in build directory.

    • Add Entitlements.plist file to project from File-New File->code Signing->Entitlements
    • Open project -> edit project settings and set 
      • Code signing entitlements to file created in previous step Entitlements.plist. 
      • Code signing entity = iPhone distribution – your name  
      • Any iOS device = iPhone distribution – your nameIf iPhone distribution – your name is not active , restart the xcode.
  
  •  Build xcode project: Clean and build it.
  • Distribute:
    For titanium developer: on successful build, app will be in under build/ Debug-iphoneos/ folder.
    Distribute app and Ad hoc provision profile (will be in folder /Users/xxxxx/Library/MobileDevice/Provisioning Profiles) to testers via email or thru web site.

     
    Finally to install on device just  drag-drop above files in iTunes and sync with device.
        If you get “Signer not valid”, please check if correct provision file is included.