13

I have a project with multiple targets that are all for different iOS Apps. For instance one traget for the lite version and another one for the pro version.

I want to build and archive all of my Apps at once. Currently I have a scheme for every target which I use to archive each app independently. But now I have to start the archiving, wait until it is done and then start the next one.

Is there a way to archive all apps with one single action in xcode 4 or using the command line?

sliver
  • 1,650
  • 2
  • 14
  • 23

2 Answers2

5

The Build action in a scheme dictates what targets are built for what actions. Leave the defaults (so they'll all be built for the Archive action). When that scheme is active, it'll build all the requested targets just prior to archiving when you select Product -> Archive.

You could create a new scheme called "All", edit it, then in its Build action, add all targets you want to archive. Then just select that scheme and ask it to archive.

Alternatively, add all targets to your existing scheme and uncheck unwanted actions for which it should build those extra targets, leaving only Archive.

Joshua Nozzi
  • 60,946
  • 14
  • 140
  • 135
  • Unfortunately this won't work, because one of the libraries (three20) I am using will not find half of the header files when compiling. But everything compiles just fine if I build all the targets independently. – sliver Apr 12 '11 at 15:12
  • What if you create an aggregate target. Select project, click Add Target, choose Other category, select Aggregate target type and set it up. – Joshua Nozzi Apr 12 '11 at 15:33
  • This solution from Joshua is so close, except if you archive, you archive the bundle, not a bunch of ipa's – Trausti Thor Aug 29 '12 at 20:33
  • 1
    I agree. So close. You can even export the generated archive into separate product files, but they're unfortunately .app files, not .ipa files. :( – devios1 Aug 13 '13 at 00:15
  • To be fair, it's a solution from Apple. I'm just a messenger. :-D – Joshua Nozzi Aug 13 '13 at 08:15
  • 2
    Did any of you find a good solution to this? I have about 10 white label apps I have targets for all in one Xcode project, would love to build individual archives in one click. – Aaron Ash Dec 09 '16 at 19:42
2

You can use xcodebuild from the commandline

e.x. xcodebuild -configuration Release -project MyProject -scheme MyProjectScheme clean build

Also you can use xcrun to build an ipa from the commandline as well, see: https://stackoverflow.com/a/4198166/618419

Community
  • 1
  • 1
Captnwalker1
  • 679
  • 7
  • 16