4

Is it possible to go from an .xcarchive bundle to an .app bundle without using the Xcode Organizer? I'd like to create an automated build and get the final .app file that I can distribute. Using xcodebuild with the archive target works great for getting the .xcarchive file, but not for the final app.

With the iOS SDK, there's a PackageApplication tool you can use with xcrun, but this doesn't appear to exist with the OS X SDK.

I'd also like to do this so I can hopefully get more diagnostics from the Distribution process, which is failing for me right now with the infamous 100021 OS error code.

3 Answers 3

5
+50

Have you looked inside the .xcarchive bundle? It's just a folder. Your .app targets should be inside, in a Products subfolder.

In Finder, right-click the archive and click Show Package Contents. in Terminal, use cd.

6
  • Sure - that's been my work-around for now. Is the Distribute action in Organizer doing anything other than copying that out, if I am not yet signing the app?
    – dcgibbons
    Commented Dec 10, 2012 at 14:32
  • I'm not sure what Distribute does, but I know you can sign the app as part of the build process itself. Commented Dec 10, 2012 at 15:15
  • I'm marking this one not answered as this solution doesn't work if I actually need to verify and submit an application to the app store.
    – dcgibbons
    Commented Jan 28, 2013 at 17:41
  • Is the output still a .app file? Commented Jan 28, 2013 at 18:21
  • I can get it to fail with Validating for the Mac App Store now, not just distribution. So there's something going on inside that the organizer doesn't like. Building an archive or whatever and then pulling the .app out is only a valid workout for a non-distriubted/signed app.
    – dcgibbons
    Commented Jan 28, 2013 at 18:31
3

Try the -exportArchive flag in the xcodebuild command:

xcodebuild -exportArchive -exportFormat app -archivePath <path to .xcarchive> -exportPath "My App.app" -exportSigningIdentity "Developer ID Application: My Software Company"

This command is present in Xcode 5.0.1. See the man page for more details on the optional arguments. This example exports a Developer ID signed application.

1

Here is what I have discovered about this issue:

  • As previously suggested, the xcodebuild's archive buildaction is good for getting the .xcarchive, but there does not appear to be an actual way to perform the validate or distribution commands from the command-line. I hope this eventually turns out to be false.

  • I was able to trick the validation tool by removing the embedded symbolic links in the embedded framework directories. This works, but after discussing with Apple support it turns out this is tricking the tool and not actually producing a valid result.

  • Apple support says they see this error code if one of the .plist files in an embedded framework is invalid. It turns out, in my example, I had 3 embedded frameworks and 1 of them had an empty .plist file, likely from me hand-building the project. After fixing that, the build would continue happily.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.