0

I am using xcodebuild to generate an archive from a workspace. I use the following command:

xcodebuild -workspace MyProject.xcworkspace -scheme "MyProject" 
           -destination generic/platform=iOS archive 
           -archivePath "../PathToArchive/MyProject.xcarchive

(I've spaced it out over multiple lines for readability)

This command generates a MyProject.xcarchive. However it generates a generic "Xcode Archive" rather than an "iOS App Archive." This cannot be submitted to the App Store.

If I archive the exact same workspace and scheme using Xcode.app version 7.0.1 (7A1001) instead of xcodebuild then I get an "iOS App Archive" which can be submitted to the App Store.

Inspecting the contents of these two xcarchives shows the main difference is the bundled Info.plist file. The one generated by Xcode.app contains an additional ApplicationProperties dict with versioning and signing details. The one generated by xcodebuild lacks these details in its Info.plist.

Copying the Xcode.app generated Info.plist into the xcarchive generated by xcodebuild "fixes" the archive, and it can be submitted to the App Store. This is not a solution however, as it means I cannot build on the command line.

Note that doing xcodebuild -version prints:

Xcode 7.0.1
Build version 7A1001

Edit: sometimes xcodebuild appears to generate a correct iOS App Archive instead of a Generic Archive. I'm not exactly sure why this happens. It's not consistent.

simeon
  • 4,466
  • 2
  • 38
  • 42
  • If you upgraded you might need to do a full clean ctrl+alt+cmd+shift+k (i think) and you would need to delete all your derived data – Jeef Oct 16 '15 at 01:33
  • @Jeef thanks for the advice but a clean and delete of derived data still results in the same issue – simeon Oct 16 '15 at 03:23

2 Answers2

1

Are you using Cocoapods? If so try using the pre release version gem install cocoapods --pre . I had the issue because of a copy pods phase being somewhere it should not have been, please go through https://github.com/CocoaPods/CocoaPods/issues/4021 you should find a solution that fits you.

insanoid
  • 413
  • 2
  • 10
  • I am using Cocoapods 0.39. Thank you for the link, I will look down that path for a fix. Does this Cocoapods issue only affect `xcodebuild` and not Xcode.app? – simeon Oct 16 '15 at 00:57
  • For me it effected both. – insanoid Oct 16 '15 at 09:17
  • Thanks for your help. I've found the cause of the problem and while it was not CocoaPods it was the "Parallelize Build" setting. Which I only thought to try after noticing someone else mention it in the CocoaPods issue tracker. – simeon Oct 19 '15 at 14:23
0

After a lot of frustration I have discovered the cause of xcodebuild producing incorrect xcarchive packages.

I had to disable the "Parallelize Build" option for the scheme I was building.

Parallelize Build Setting

After un-ticking this option, the builds take a lot longer, but xcodebuild is consistently producing an "iOS App Archive" rather than a "Generic Archive." With "Parallelize Build" enabled xcodebuild would generate a "Generic Archive" 90% of the time, occasionally generating a correct archive.

Because I wanted my build times within Xcode to remain unaffected, I left the "Parallelize Build" option enabled for my schemes. I duplicated the schemes to be built with xcodebuild and un-ticked the option only for the deployment schemes.

simeon
  • 4,466
  • 2
  • 38
  • 42