简体   繁体   English

xcodebuild生成与Xcode 7.0.1不同的存档

[英]xcodebuild produces different archive to Xcode 7.0.1

I am using xcodebuild to generate an archive from a workspace. 我正在使用xcodebuild从工作区生成档案。 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 . 此命令生成一个MyProject.xcarchive However it generates a generic "Xcode Archive" rather than an "iOS App Archive." 但是,它会生成通用的 “ Xcode存档”而不是“ iOS App存档”。 This cannot be submitted to the App Store. 无法将其提交到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. 如果我使用Xcode.app版本7.0.1(7A1001)而不是xcodebuild存档完全相同的工作区和方案,那么我会得到一个“ iOS App存档”,可以将其提交到App Store。

Inspecting the contents of these two xcarchive s shows the main difference is the bundled Info.plist file. 检查这两个xcarchive的内容表明,主要区别在于捆绑的Info.plist文件。 The one generated by Xcode.app contains an additional ApplicationProperties dict with versioning and signing details. Xcode.app生成的一个包含附加的ApplicationProperties字典,其中包含版本控制和签名详细信息。 The one generated by xcodebuild lacks these details in its Info.plist. xcodebuild生成的代码在其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. 复制Xcode.app产生的Info.plist到xcarchive所产生xcodebuild “修复”存档,可以提交到App Store。 This is not a solution however, as it means I cannot build on the command line. 但是,这不是解决方案,因为这意味着我无法在命令行上构建。

Note that doing xcodebuild -version prints: 请注意,执行xcodebuild -version输出:

Xcode 7.0.1
Build version 7A1001

Edit: sometimes xcodebuild appears to generate a correct iOS App Archive instead of a Generic Archive . 编辑: 有时 xcodebuild似乎会生成正确的iOS App存档,而不是Generic存档 I'm not exactly sure why this happens. 我不确定为什么会这样。 It's not consistent. 这是不一致的。

Are you using Cocoapods? 您正在使用可可豆吗? If so try using the pre release version gem install cocoapods --pre . 如果是这样,请尝试使用预发行版本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. 由于复制吊舱阶段不应该出现在某个地方,因此出现了问题,请访问https://github.com/CocoaPods/CocoaPods/issues/4021,您应该找到适合您的解决方案。

After a lot of frustration I have discovered the cause of xcodebuild producing incorrect xcarchive packages. 经过很多挫折之后,我发现了xcodebuild产生错误的xcarchive软件包的原因。

I had to disable the "Parallelize Build" option for the scheme I was building. 我必须为正在构建的方案禁用“并行构建”选项。

并行构建设置

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." 取消选中此选项后,构建会花费更长的时间,但是xcodebuild始终生成“ iOS App Archive”而不是“ Generic Archive”。 With "Parallelize Build" enabled xcodebuild would generate a "Generic Archive" 90% of the time, occasionally generating a correct archive. 启用“ Parallelize Build”后, xcodebuild将在90%的时间内生成“通用存档”,偶尔会生成正确的存档。

Because I wanted my build times within Xcode to remain unaffected, I left the "Parallelize Build" option enabled for my schemes. 因为我想 Xcode我的生成时间不受影响,我离开了我的计划中启用了“并行化编译”选项。 I duplicated the schemes to be built with xcodebuild and un-ticked the option only for the deployment schemes. 我复制了要使用xcodebuild构建的方案,并取消了仅针对部署方案的选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM