iPhone App Ad Hoc Distribution Gotchas


I spent more time trying to get Ad Hoc distribution work than any other issue that should have taken 15 minutes. There are a number of things which can go wrong, some of which are ridiculous and Apple will no doubt fix in time, but for now you should know these:

The biggest gotcha: you can not use the “Compress” option in Finder to bundle the Ad Hoc package. It adds files that cause iTunes to freak out. I wrote a quick shell script to bundle everything up and zip it together using the command line zip tool.

mkdir Payload
cp -rp MyApplication.app Payload/
zip -r MyApplication.ipa iTunesArtwork Payload

This way, you can give people the .ipa and .mobileprovision file. Tell them to drag the .mobileprovision into iTunes, and then double click the .ipa. How easy was that?

Another semi-obscure fact: iTunesArtWork is a 512×512 png, named simply ‘iTunesArtwork’ without the extension that needs to be included ONLY with Ad Hoc copies so the icon shows up in the iTunes window. You don’t need to include it, but if you do make sure you only do so when sending out Ad Hoc copies.

One more thing that caught me over and over again: don’t forget to increment the version number in your info.plist file before giving Ad Hoc users a new copy! iTunes is really sneaky about what happens here…in both cases it says the application is already installed, and asks if you want to replace it, but if you try to replace with the same or lower version number, it won’t actually do anything.

If you are getting

Application was not installed on the iPhone because it could not be verified.

then your profile isn’t valid and you should check out this post. This biggest thing to remember is

  1. Delete all the profiles stored in ~/Library/MobileDevice/Provisioning Profile.
  2. Double click your .mobileprovision file and it will get loaded into XCode.
  3. Quit XCode completely. I’m not sure why this is necessary, but often XCode refuses to build unless it starts up with the profile already ready.

Lastly, ensure not only that Entitlements.plist is included in your project (click File, New File, Code Signing, Entitlements), and that get-task-allow is unchecked, but in your “Ad Hoc” build profile (Project, Edit Active Target) expand the list to “All Settings” make sure the “Code Signing Entitlements” field is filled out with your “Entitlements.plist”.

  1. #1 by Mel on May 4th, 2009

    ~/Library/MobileDevice/Provisioning Profile

    Is that located in HD?

  2. #3 by Ben Henderson on May 24th, 2009

    Thanks for the good info, Eric.

    Should line 4 of the script be “mv MyApplication.zip MyApplication.ipa”?

    - Ben

    • #4 by Eric on May 24th, 2009

      Yes, my bad. Forgot to change that while copying and pasting ;) .

  3. #5 by Thomas Swift on June 11th, 2009

    Thank you, Thank you. I have been having a difficult time getting ad hoc to work, your tips helped me out. Thanks again!

    • #6 by Eric on June 22nd, 2009

      Great to hear! The feedback I’m getting is really encouraging, I’ll keep trying to post solutions to some of the tricky problems that popped up.

  4. #7 by Eelco on July 17th, 2009

    Thanks! Making an .ipa file is very nice trick.

    One remark, you don’t need to rename the file if you simply give it the .ipa extension when zipping: zip -r MyApplication.ipa iTunesArtwork Payload

  5. #9 by Jirapong on September 21st, 2009

    Thank you… it is very helpful.

  6. #10 by PixelWrangler on November 21st, 2009

    Thank you! I had tried just about every combination of file arrangements and nothing worked. Even when iTunes recognized the app, I was getting a “resources have been modified” error when syncing. This was the fix that finally did the trick.

  7. #11 by Rajalakshmi on December 3rd, 2009

    Thanks Eric.. I fix the issue by following your instruction…

  8. #12 by Joris on December 14th, 2009

    Funny, I read this everywhere, however on my machine i ONLY get ad-hoc build to work by making a Payload directory, copying my app in there (all in Finder!) and then right-clicking an compressing the payload dir and renaming the file to Something.ipa.
    I tried writing scripts to automate this post ad-hoc build but I always had problems with that (signing issues)

  9. #13 by Roderic on January 18th, 2010

    I’m still getting that my Entitlements are invalid. I have not been able to solve this all day.

    I’m using the iphone that I used through development. I’m trying to simulate giving the .ipa to my friends for closed beta testing but I keep running into this same error. Any other thoughts?

    • #14 by Eric on January 20th, 2010

      I wish I had some tips, but all I can recommend is starting over from scratch and trying again. Delete what you currently have, and set up the certificates up brand new. Might help!

  10. #15 by Daniel on February 5th, 2010

    If you want to test installing it on a Windows box with no provisioning profiles, you may also need to remove the mobileprovisioning files for that user. On Windows they’re kept in

    C:\Documents and Settings\\Application Data\Apple Computer\MobileDevice\Provisioning Profiles

  11. #16 by Daniel on February 5th, 2010

    In post 15 it changed the username because I used angle brackets. This is the correct location:

    C:\Documents and Settings\username\Application Data\Apple Computer\MobileDevice\Provisioning Profiles

  12. #17 by Scott Heaberlin on February 14th, 2010

    Thanks for the .ipa trick; worked 1st try. That should be in Apple’s Ad-Hoc distribution HOWTO on the program portal, but it’s not.

  13. #18 by Charles T on February 17th, 2010

    Thanks Joris. Your modified tip finally got my ad hoc distribution working after 2 days!!

(will not be published)