Saturday, May 1, 2010

Xcode 3.2: Build and Archive

One aspect of iPhone development that I'm no big fan of is ad hoc distribution. In Xcode 3.2, Apple added a new feature to Xcode that makes ad hoc distribution more than a fair bit better. But, for the first few weeks of using Xcode 3.2, I didn't even notice this item. I know many of you probably have, but I've talked to enough people that also missed it, that I figured it's worth a short post.

This new item lives under the Build menu, but frankly, I don't use menus much in Xcode. I use a very custom set of key bindings and have all my regular tasks' key commands memorized. The new option is called Build and Archive.

I still wish Apple would get rid of the whole process, but it's unlikely they will in the near future. In light of the situation, this makes life much, much better. It's a pretty good compromise between Apple's desires and the needs of developers, all in all.

Build and Archive builds your application, code signs it, and stores the application folder along with its symbols file (which you need to decode crash logs generated by ad hoc or release builds). Xcode's Organizer window gives you ready access to any previous build, and lets you e-mail an ad hoc build packaged up as an .ipa file with the mobile provisioning profile you compiled with embedded right into the application. This allows your clients or tester to simply drag the generated .ipa file into iTunes. The organizer will even generate an e-mail with the .iap embedded in it.

Screen shot 2010-05-01 at 9.43.08 AM.png

Screen shot 2010-05-01 at 9.45.42 AM.png

As part of Build and Archive, Xcode checks your application to make sure it's code signed and provisioned properly. It may also (depending on your project settings) automatically run the new Validate feature that checks to make sure your application is valid for app store submission. This is the same check that the app review team will run on your app before actually looking at it. The details of what Validate checks are not documented, but in general terms, it will make sure everything is okay and that you haven't used anything you shouldn't have used. It's not a guarantee that your app won't get rejected because there's still the manual review for content and HIG, but if your app passes validation, that's one less possible obstacle between you and the app store. In other words, make sure you validate your apps before submitting them.

One thing to note, however, is that when you use Validate for ad hoc builds instead of building for submission to the app store (and I recommend that you do so that you find problems before testing rather than after), your app may fail one of the Validate checks. If you get this warning message when using either Build and Archive or Build and Validate with an ad hoc build:
warning: Application failed codesign verification. The signature was invalid, or it was not signed with an Apple submission certificate. (-19011)
You might be fine (assuming you received no other warnings or errors). The difficult thing is that this warning can be generated by more than one specific problem, so there's no way to know for sure whether this needs to be addressed other than to try and install the generated .ipa file on a non-development phone. You may (will?) get this warning with ad hoc builds even if the build is fine because you don't use an "Apple submission certificate" for ad hoc builds.

One of the best things you can do is to have a second iPhone or iPod touch that's not used for development (ever) that you can use to test ad hoc distributions. Even a second-hand, cheap iPod touch is sufficient since all you're testing is that the install works If you do this, make sure you add the UDID of this unit to your ad hoc distribution profiles, but not to your development profile.

When you see this warning with Validate when building using an Ad Hoc Distribution configuration, don't panic, but do try and install it on a machine that doesn't have your development profile installed before sending it to a tester or client.


JFMartin said...

Thanks for sharing Jeff. Wrote a small blog post on my own blog that link back to you.

Michael said...

Anyone else having an issue with Sharing an archived build. Basically nothing happens if I choose email or Save As…very strange. Build has no errors etc.

Maybe I need to reinstall 3.2…

Michael said...

OK fixed by re-installing Dev Tools - just incase anyone else has this issue.


Greg Meach said...

I fixed or rather removed this error:
"warning: Application failed codesign verification. The signature was invalid, or it was not signed with an Apple submission certificate. (-19011)"
By reinstalling Xcode (non-beta). In fact I only received that error after installing the second beta of 4.0

mauitom said...

As a hobbyist programmer, I too find ad-hoc a mess. Thanks for this post.

Is there a distribution path other than ad-hoc where you could distribute an app to just a few family members or friends that doesn't have a time limit on it from the provisioning file?

JES said...

This must be a feature of Xcode 3.2.2. It is not available on my 3.2.1.

Mike Weller said...

Anybody know how to generate these .ipa files using xcodebuild from the command line?

daves said...

Hi, thanks for sharing. You need for web application products

web applications

Tommo said...

Even after producing my IPA using build & archive, the end-user still required me to send the .mobileprovision before he could install. Has anybody had a .mobileprovisionless distribution actually work to someone who didn't already have the provisioning file?

Robin Hos said...

Missed that option too. Is there a possibility to add iTunesArtwork to the ipa file with XCode for Ad Hoc distribution?

michaelvk said...
This comment has been removed by the author.
jdmuys said...

How did you include the itunes artwork in your build and archive? I tried several ways to include my iTunesArtwork file in my project, but I always get my archive build with a big question mark instead of my artwork.



Kallewoof said...

Michael: thanks for posting that. I was beating my head against the monitor over "Save As" suddenly not doing anything.

Migrating from one Mac to another brought XCode with it, but somewhere something must've gone gook. Reinstalling XCode on the new machine fixed the Save As issue. Yay!

colionel said...


I finally found how to automate the build and archive process from the comand line !! I just wrote a blog article explaining how you can achieve that.

The command you have to use is "xcrun" :

/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${RELEASE_BUILDDIR}/${APPLICATION_NAME}.app" -o "${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa" --sign "${DEVELOPPER_NAME}" --embed "${PROVISONNING_PROFILE}”

You will find all the details in the article ! If you have any questions dont hesitate to ask.

Hope this helps,

SEO Services Consultants said...

Nice information, many thanks to the author. It is incomprehensible to me now, but in general, the usefulness and significance is overwhelming. Thanks again and good luck! Web Design Company

Philipp Kyeck said...

if i try to use Build&Archive i get the error message:

"unable to copy dSYM fine into archive ..."

but in the project settings i set the "debug information format" to "dwarf with dSYM file".

maybe you could shed some light on this ... ? :)

Gavin said...

Great tip and much easier to send just the one .ipa file... should be the default!

h4ns said...

What youre saying is completely true. I know that everybody must say the same thing, but I just think that you put it in a way that everyone can understand. I also love the images you put in here. They fit so well with what youre trying to say. Im sure youll reach so many people with what youve got to say.

Arsenal vs Huddersfield Town live streaming
Arsenal vs Huddersfield Town live streaming
Wolverhampton Wanderers vs Stoke City Live Streaming
Wolverhampton Wanderers vs Stoke City Live Streaming
Notts County vs Manchester City Live Streaming
Notts County vs Manchester City Live Streaming
Bologna vs AS Roma Live Streaming
Bologna vs AS Roma Live Streaming
Juventus vs Udinese Live Streaming
Juventus vs Udinese Live Streaming
Napoli vs Sampdoria Live Streaming
Napoli vs Sampdoria Live Streaming
Fulham vs Tottenham Hotspur Live Streaming
Fulham vs Tottenham Hotspur Live Streaming
AS Monaco vs Marseille Live Streaming
AS Monaco vs Marseille Live Streaming
Alajuelense vs Perez Zeledon Live Streaming
Alajuelense vs Perez Zeledon Live Streaming
Technology News | News Today | Live Streaming TV Channels

deansx said...

I can't figure out how the Entitlements.plist file fits in to this scheme. If I do a Build and Archive using my ad-hoc provisioning profile, the resulting .ipa won't run on my own device, unless I add the Entitlements.plist file. Will it run on non-development test devices without the Entitlements.plist file?

My resources are too constrained to have a device sitting here that's not for dev, and my pool of external testers is "unreliable."

openid said...

Wow a great detailed post. I think its really useful option in X-Code. I am right now trying to send my app for some beta testing. Will use 'Build and Archive' now.

healthpharmacyrx1 said...

proscar achat france
strattera Ohne Rezept Bestellen
levitra Bestellen Rezeptfrei
Order cialis soft Online
zithromax Ohne Rezept
amoxil Rezeptfrei
cialis Kaufen
lamisil Ohne Rezept
lamisil Prix de Vente
achat priligy
Prix accutane Pharmacie
acheter propecia en france
Kaufen plavix Online
propecia Rezeptfrei Kaufen
achat strattera en ligne