Wednesday, January 25, 2012

How to Release iOS Ad Hoc Beta Builds with Xcode

After you have a running app and you have done enough testing on your iPhone and your other iDevices, the next step before submitting to the AppStore is to test on as many devices as possible. This type of testing is usually called beta testing. Beta testing is crucial in developing a great mobile app because of generally two types of feedback given by beta testers:
  1. Compatibility problems. Even though everything might be sweet and sublime on your iPhone or iPad, it might not be the case for every combination of device and iOS version. Beta testing with hardware/software diverse testers will uncover all or most of those problems.
  2. General story/usability flaws. This category is not about bugs. It's about understanding what part was confusing to your beta users or what false assumptions did you make. Beta testing will help bring your assumptions and perspective inline with real users.



In this guide I will give the procedure for how to generate ad hoc builds that you can send to your beta testers to try. I could not find a single tutorial that covered all the related issues so I decided to write this. This procedure does not require registering in the iOS Developer Enterprise Program. All that is required is the standard iOS Developer Program. This guide was written using Xcode 4.2.

  1. Ask your users for their device ID's and add them in the iOS Provisioning Portal. Testers can find their device ID's from iTunes or from Xcode in the Organizer window. Using TestFlight (more on that later) can also simplify getting device ID's from users. TestFlight will email the tester's device ID once he/she registers.
  2. Create a Distribution Ad Hoc Provisioning profile in iOS Portal and select all the devices for the beta users.
  3. Download the new provisioning profile and install it in Xcode by double-clicking it or dragging it into the Xcode icon. Keep this file handy because we will need upload it to the web along with the ipa file and allow users to download it. Select this provisioning profile for code signing for the Release version of your project and targets.


  4. Select "iOS Device" from your build schemes. the Archive button is disabled when the Simulator is selected.

  5. Add an Entitlements file. In Xcode 4.2 you cannot add an Entitlements file by going to File -> New -> New File --like previous versions. You must select your project in the top left corner then click on your main target. Then scroll all the way to the bottom and check the box for Enable Entitlements.
  6. If you have more than one target in your project then you must select "Yes" for the Skip Install setting under Deployment for all targets other than your main project target. You will end up with multiple targets if you are linking to other projects or have unit tests.
  7. From the main menu select Product --> Archive.
  8. From the Organizer - Archives window press the button Share.
  9. Select iOS App Store Package (.ipa) and the correct signing identity for your build. Then press Next.
  10. Type into the Save As field on top the name you want to give the files. Check the box for Save for Enterprise Distribution on the bottom. Enter the URL where the file will be hosted without the file name. All you need is the URL up to the directory path. Add a title for your app then press Save.
  11. You should now have generated two files, a .ipa file and a .plist file. All you have to do now is upload these two files to your website along with your provisioning file (from step 3) then link to them on a webpage like shown below. The ipa and plist file must be in the same directory and must have the same name except for the extension. Your users should install the provisioning file first then install the app.

    Another option is instead of simply hosting these files on your website, you can utilize a service like TestFlight for better tracking and user experience. Using TestFlight is easy and you can use the TestFlight SDK to allow the users to send feedback and track how long the testers used the app and so on. For more on TestFlight visit: https://testflightapp.com/


    <html>
    <head>
    <title>Install iOS App</title>
    </head>
    <body>


    <a href="My_Provisioning_Profile_Ad_Hoc.mobileprovision">Install Team Provisioning File</a>


    <a href="itms-services://?action=download-manifest&url=http://yourwebsite/betafolder/myFavAppName.plist">Install Application</a>


    </body>
    </html>



You should provide your testers with links to the provisioning profile (.mobileprovision) and IPA file as shown above. Instruct them to install the provisioning profile first. However you should look into TestFlight for better management and tracking. There, that should get you started with installing all your cool apps on your friends' devices before you hit the AppStore.