Ad-Hoc App Distribution with XCode 4


Update (12-02-2011): The process of deploying to the app store was fairly simple using this new archive process. The only catch was editing the scheme to change the Archive option to use the AppStore code signing identity and using the Submit button instead of Share. Check out the app in the iTunes AppStore – Autograph This!

So amongst the many nice features in XCode 4 comes the modified process for building your app for distribution. And with “The Google” not being entirely helpful about the process as well as the docs on the Apple developer site still containing the XCode 3 instructions I thought it would help at least somebody out there for me to document the process. Please note that since I haven’t built one yet for distribution to the app store this just covers ad-hoc distribution. Maybe I’ll update this when we release to the app store.

Interacting with the provisioning portal hasn’t changed. You still need to create your distribution profile and download it to your development machine. Once you’ve done that is where the process has changed.

Like in XCode 3 you still need to create a new configuration for your distribution build. Click on your project in the project navigator and click on the your project in the project editor. You should see something like this:

As before you’ll want to create a copy of your release configuration and name it something like “Ad-Hoc”. Once you’ve done that click on the “Build Settings” tab in the project editor. You should see something like this:

Change your Code Signing Identity to match your Ad-Hoc distribution provisioning profile. Now in the upper left hand corner of XCode next to the Run and Stop buttons click the Scheme dropdown and click Edit Scheme. In the scheme editor select Archive from the left side and change the Build Configuration to the configuration you created previously (Ad-Hoc for me):

Click OK to close it. Verify that you have a iOS device selected in the scheme dropdown in XCode and then select the Archive option from the Product menu:

This will build your project and create the archive. If the Organizer doesn’t pop up after it is done building  just open it by clicking the Organizer button:

Select your new archive and click the Share button (I imagine the Submit button here has to do with submitting to the app store):

Leave it on “iOS App Store Package (.ipa)” and select your distribution profile in the identity (you may be able to say “Don’t Re-sign” but I haven’t tried that yet) and click Next:

Save it to whatever location and now you have an IPA file to drag into iTunes.

About these ads

About Ruprect
iOS, Android and web developer

72 Responses to Ad-Hoc App Distribution with XCode 4

  1. shawn says:

    Hello…

    Thanks for this. A couple questions:
    1) Do you still have to create an Entitlements.plist?
    2) Also, what about the Identifier (e.g. com.yourcompany.appname)? Don’t you need to modify (or verify) this too?

    Thanks,
    Shawn

    • Ruprect says:

      1) I’ll be honest here. I have no idea. Allow me to elaborate:

      I’ve done a couple of ad-hoc deployments for beta testing or client approvals and I can honestly say I’ve never created a Entitlements.plist file. When I initially read your question it triggered something in my memory but I had to look up the purpose of the file (still don’t know what the purpose is after spending an hour Googling so if someone can explain please let me know). According to what I read the file is supposed to be necessary for creating ad-hoc builds or at least it enables us to work around some issue? I don’t know. Either way I’ve never created one. I opened my current client project (the one I was working on when I decided to document the process in the post) and looked for one thinking maybe I did it and don’t remember but nope. The clients haven’t had an issue installing the app and running it on their iPads and they are most definitely not setup as development devices.

      So I guess the best thing I can say is to try it out without the Entitlements.plist file and see what happens.

      2) Yes. The bundle identifier in the application plist still needs to match the application identifier on the provisioning profile. I was mostly concerned with outlining the differences.

      • Just a quick comment on 1): According to Apple’s documentation, it is necessary to set the value “Can be debugged” to NO for Ad Hoc distribution and the Entitlements.plist is where you specify this.

        Even if it does work without it, its always a good idea to stick to the documentation if you won’t get in trouble.

        If you’re interested in details and how to setup this file, you can check this tutorial: “How to create an IPA (XCode 4)”
        http://support.testflightapp.com/kb/tutorials/how-to-create-an-ipa-xcode-4

    • MBlack says:

      For what it’s worth, as of 4.0.3 you do not need Entitlements.plist. I just sent a game to 3 testers ad-hoc style.

  2. Sam at FPS says:

    Thanks for this post, it was very helpful. Once you know how to do it, it’s really quite a straightforward process in Xcode 4.

  3. neil says:

    Hi,
    thanks for confirming what I’ve found so far. Would you mind to elaborate, whether the “AdHoc” Build profile creation is _really_ necessary? I mean can’t you leave “Archive” as is (Release) and specify the signing profile in the moment, when you share it in the organizer? I have examined the binary output. The certificate used is my distribution certificate and the embedded.mobileprovision file contains all my beta UDIDs, so it seems to be sufficient to have the default release configuration and select the signing certificate in the moment, you share. Because I currently don’t have an update for my app store apps, I can’t say how it works for the store, but I suppose, there is also a signing selection box right before the app is uploaded.

  4. neil says:

    Yepp. The doc is very specific on this. There seems to be just one setting of relevance: “Skip install” for the release build in order to ensure, that static libs are included. Google for “XCode4 user guide” and check “Distributing Applications”.

  5. Mike says:

    Thanks for this, being in xcode 3 for so long Apple should give a quick little demo about “Now it’s done this way!”

  6. Justin says:

    Wow, this looks like exactly what I wanted to learn about, but it’s hard to follow with all the images broken. :(

  7. suleman says:

    thanks a lot ,please help us with app store distribution… im facing a big problem with it.

    • Ruprect says:

      I’m not due to do an app store release for a few weeks. I’ll post something when I do it but chances are somebody else already has something out there about the process.

  8. Hugo says:

    Wow, this is exactly what I was looking for, thanks!
    I am a bit lost with Xcode 4.

  9. freedev says:

    My project.xcodeproj was built with an old versione of Xcode.
    Now trying with Xcode 4 I cannot find Code Signing Identity Ad Hoc.

    Any help appreciated :)

    • Ruprect says:

      The project I’m working on was started in Xcode 3 as well. I think you’re referring to screen shot 2 where we are looking at the Build Settings tab? The Code Signing Identity Ad Hoc doesn’t show up there until you create the AdHoc build configuration (outlined just above that screen shot).

  10. Pingback: How to build and submit iPhone app for distribution with Xcode 4 | OOPS

  11. Emeric says:

    Hi there, thanks for the useful help. However, it didn’t work as expected for me. Everything’s fine until I click on “Share” on the organizer>archive tab. I have the window pop up but the first item in the radio buttons list is “Package (No Packager exists for the type of archive)”. Therefore, I can’t choose iOS store package like you and I can’t apply my Adhoc provisionning profile to the archive.

    (And it’s driving me crazy…).

  12. Emeric says:

    Thanks, it worked. I use texturepacker and Cocos2D, so I had to set the “Skip install” flag to “YES” in the build settings for these libraries. Also, if I understood well, now the provisionning profile is included in the app package (IPA). You don’t have to send the .app & the profile to the user as we used to do.

  13. Frank says:

    Thanks Ruprect. You saved my day. It’s working like a charm again. I’m beginning to like xcode4 more and more compared to xcode3.

  14. dami says:

    Hi

    I’ve followed all the steps and a message errors appears when i drag the ipa file into iTunes:

    The app”XXXX” could not be added to your iTunes library because it is not a valid app.

    ?¿

  15. vipeakbecky says:

    Now trying with Xcode 4 I cannot find Code Signing Identity Ad Hoc

  16. Greg says:

    Just wanted to say thanks, exactly what I needed to know.

  17. SameerG says:

    After following all this process, I am getting an error while sharing the build – “Operation could not be completed.No such file or directory exists”.
    I don’t know what n where the problem is. What to do?

  18. larick says:

    VERY helpful. Thanks.

  19. Sid says:

    thanks mate!

  20. Thanks, I’m not quite sure why Apple had to mess with the menus so much in XCode 4 but your post stopped me banging my head against the desk too many times!

  21. jcp says:

    great tutorial! keep on writing! you saved my day!

  22. Rainer says:

    Thank you, you really made my day. I didn’t realize you had to edit the “archive” scheme.

  23. peter40b says:

    Awesome tutorial. Too bad Apple can’t get the online provisioning docs up to XCode 4 so many months after release…

  24. Pingback: Create IPA for AdHoc Distribution |

  25. Josh says:

    dude, this totally should be on apple.com. Thanks so much!

  26. Pingback: Ad-Hoc App Distribution with XCode 4 « Darkwind

  27. Pingback: iPhone App install to client (UAT) « VICOSYS

  28. Brian says:

    Thank you so much. I was going crazy until I found this.

  29. Swapna says:

    Hey, you blog saved my day. Creating distribution profile was turning into nightmare until i found this. Thanks a lot.

  30. Apple Singh says:

    Hi,
    I was wondering if I create a distribution provision profile and distribution certificate and give it to other people to create an archive will it work?

    Thanks in advance,
    Apple Singh

    • Ruprect says:

      I’d have to mess around with it to answer definitively but there’s probably going to be some hang up with the developer key that needs exported in order for the app to be signed with the certificate. You should be able to export that to send to them though.

  31. Apple Singh says:

    Thanks Ruprect, yes we need to send the developer’s private key in addition to the distribution profile and the certificate in order to build it in another XCode, I tested it and it works.

    Thanks,
    Apple Singh

  32. Amit Singh says:

    Nice Post….

  33. KomodoDave says:

    You’re a hero for this post, just saved me from excruciating, laborious research :) Thank you very much.

  34. Roger says:

    I’ve already referred to this article twice in two days – thank you!

  35. Kwon says:

    wow. thanks for this post.

  36. AD says:

    I never get any archives at all. Its getting very annoying

  37. John Carey says:

    Oh I’d been searching for this for weeks! Thanks for your initiative and clarity :-)

  38. ram says:

    i have been using ad-hoc distribution using xcode 4 for a few weeks now without any problems to our beta users, however some of our beta users upgraded their iOS4 to iOS5, since then no one of them is getting to download/install out beta app over the air only by downloading the signed ipa with their udid and sync it using iTunes.. needless to say that this is a huge setback for us.

    does anyone know how to solve this?

    thank you all in advance!

  39. Ralf says:

    Thanks,
    I have been struggling with all sorts of issues and this is like finally coming home.
    Anybody that could explain the “Save for Enterprise Distribution” i.e. checking the
    checkbox with that label in the archiving process?

    Thanks,
    /Ralf

  40. Pingback: PowenKo > iOS > Begin > submit your app to App Store. | PowenKo 柯博文

  41. Wolf Loescher says:

    +1 very helpful!

    To round this out, here’s what you need to send to your end users:
    1. Provisioning Profile (e.g. Ad_Hoc_Distribution_Profile.mobileprovision)
    2. Application Archive (e.g. MySuperCoolApp.ipa)

    The end user should then follow these steps
    1. Drag the Provisioning Profile onto your iTunes icon.
    2. Drag the Application Archive onto your iTunes icon.
    3. Ensure that the application is checked under the “Applications” section for your device in iTunes.
    4. Sync your device.

    • Ruprect says:

      I think the provisioning file is bundled into the IPA now (with iOS 4.0 and above?) so sending the mobileprovision file is not necessary anymore.

      • Mutix says:

        I thought this was the case too, but I have had problems in the past where users couldn’t install the .ipa without the provisioning profile (archived with Xcode 4.3.2) ?

  42. Fred Covely says:

    I’ve been deploying apps to developers out of xcode 4 for a while…. I ran into a situation where a new tester has an iPhone and is getting an error 0xE80003FFE when he tries to install via the above described methods out of Itunes. Any ideas on what that error may mean… same app successfully installs on multiple other phones.

  43. Pingback: Xcode process | Memorialtees

  44. Slim says:

    When I built the archive I got this warning: “warning: Application failed codesign verification. The signature was invalid, contains disallowed entitlements, or it was not signed with an iPhone Distribution Certificate. (-19011)”

    What does that mean?

    • Ruprect says:

      Sounds like you have an issue with your certificates and provisioning profile. Did you create a distribution certificate and then use it to sign the ad-hoc distribution profile on the iOS developer site?

      • Slim says:

        Yes.

      • Ruprect says:

        Did you download both the certificate and the profile to your machine? If so then it might have something to do with the entitlements but I haven’t had a whole lot of experience with those.

      • Slim says:

        Ruprect :
        Did you download both the certificate and the profile to your machine? If so then it might have something to do with the entitlements but I haven’t had a whole lot of experience with those.

        Seems there was something wrong with selections in code signing in Project settings. Warning seems to have gone away.

  45. Slim says:

    Also, I guess this is new in XCode, but when you build the archive, instead of the “Share” and “Submit” button, there’s just a “Distribute” button, which leads to secondary view to select whether to share it etc.

  46. Slim says:

    Ruprect :
    Did you download both the certificate and the profile to your machine? If so then it might have something to do with the entitlements but I haven’t had a whole lot of experience with those.

    Yes, I did download them both.

  47. iperalta says:

    Thanks for the report! What’s very helpful!!

    But I’ve a problem, I’ve third part libraries, and when I archive the file I can not configure the third part library target to generate just one .IPA on the Organizer. Appears one for target.

    Anybody nows how to configurate the 3rd part library target to solve this problem!

    Thanks

  48. Pingback: Confluence: Dept: Product Development

  49. From the comments about it looks like I’m the only one, but you’ve lost me at:
    As before you’ll want to create a copy of your release configuration and name it something like “Ad-Hoc”. Once you’ve done that ….

    As a Phonegap n00b that goed a bit too fast for me.

  50. Ah, found it.
    One needs to be on the the Project -> Info page and then, under “Configurations” click on the + and choose “Duplicate ReleaseConfiguration”

    • Ruprect says:

      I was just typing that up for you. Glad you found it.

      When I wrote this post I was really just making notes for myself and I was more documenting changes from Xcode 3 to Xcode 4 so I kind of assume that the reader is familiar with Xcode 3.

  51. Thanks Ruprect.
    Since I’m asking questions anyway, here’s another:

    I have created an AdHoc distribution profile in the Provisioning Portal, downloaded it, “installed” it in XCode4 where it indeed shows up.
    Now, where you say “Change your Code Signing Identity to match your Ad-Hoc distribution provisioning profile” I selected this “MyApp Test Profile” but after creating the Archive I don’t get a Share option in the Organizer.
    I’ve repeated the process with another provisioning profile, but the same thing happens.
    Any thoughts on that?

    • Ruprect says:

      It’s now a “Distribute” button and you need to select the “Save for Enterprise or AdHoc Deployment” option. I’ll probably update this post when Xcode 4.5 is officially released due to changes like this.

      • Abe says:

        Please do so. I’m really new to this ad-hoc deployment and have since heard it’s a lot easier to deploy your apps (with certificates). However, if you could elaborate the newer methods it would really help a newcomer like myself out.

  52. Pingback: Ad-hoc distribution in XCode 4 - feed99

  53. Pingback: Ad-Hoc 으로 앱 배포하기 with XCode 4.5 + | 풀타임 맥 유저 런더너의 워드프레스

  54. Pingback: Xcode 4 Ad-Hoc Distribution - Unable to Download - Tech Forum Network

  55. Pingback: Joel Eaton Creating test apps with distribtution profiles in Xcode4 » Joel Eaton

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: