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. Mel says:

    ~/Library/MobileDevice/Provisioning Profile

    Is that located in HD?

  2. Thanks for the good info, Eric.

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

    - Ben

  3. Thomas Swift says:

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

    • Eric says:

      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. Eelco says:

    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. Jirapong says:

    Thank you… it is very helpful.

  6. 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. Rajalakshmi says:

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

  8. Joris says:

    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. Roderic says:

    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?

    • Eric says:

      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. Daniel says:

    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. Daniel says:

    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. 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. Charles T says:

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

  14. John says:

    Thank you for your tips. They worked great. I was having a lot of trouble getting my apps setup on other devices and it was because I was using the build in “compress” command.

  15. Alex Clark says:

    Great tip. Worked like a charm. I spent a whole day trying to figure that one out before I found your site. Much appreciated!

  16. I couldn’t get the zipping to work – when I double click the .ipa file I get ‘The application ‘YourApp.ipa’ could not be added to your iTunes library because it is not a valid application. It works if I just drag the uncompressed file onto there, though.

  17. andrew says:

    I had a similar problem and for me it was because the mac zips it in a way that has compatibility issues on windows Dang it! Anyway, I used a different zipping program and it worked. I found info from here. http://labs.makingwaves.com/2010/09/03/distribute-ad-hoc-iphone-apps-as-ipa-files/

  18. kunde says:

    Lots of incredibly good reading here, many thanks! I was searching on yahoo when I found your article, I’m going to add your feed to Google Reader, I look forward to more from you.

  19. This is such an informative post. I wanted to thank you for this informative read of the subject. I ate every bit of it and I submitted your site to some of the biggest social networks so others can find your blog.

  20. Pravin says:

    I want to install my application on every ipad using adhoc and without app store, is it possible? and if yes then how? please advice?

    note:- i know using UDID but if i dont know UDIDs then?

  21. RomanABF says:

    hello,

    we’re not sure anyone’s interested in wanting to get an Iphone 4-s or not, but here is a site i located that offers a contest giving them away. its easy & painless to enter and FREE!

    good luck

  1. [...] ran across all kinds of posts on this issue and solved the problem thanks to this post. Note, however, that somehow the .ipa file still caused the install to fail, so I only went as far [...]

  2. [...] send it to your testers along with your .mobileprovision file. As John Hartzog discovered, however, using the Compress option in Finder for Ad Hoc distribution has drawbacks so you should use the command line to package up your Ad Hoc [...]

  3. [...] process — the technical side of Ad Hoc distribution is thoroughly documented by Apple and others. The tools I use are simple and free. They work. If you have suggestions for better ones, I want to [...]

  4. [...] iPhone App Ad Hoc Distribution Gotchas – JohnnyWorks (tags: ipa adhoc) [...]

  5. 手機收購 says:

    手機收購…

    [...]JohnnyWorks » Blog Archive » iPhone App Ad Hoc Distribution Gotchas – Programming projects and sample code[...]…

  6. De leukste filmpjes gratis plaatsen en bekijken….

    [...]JohnnyWorks » Blog Archive » iPhone App Ad Hoc Distribution Gotchas – Programming projects and sample code[...]…

Leave a Reply