简体   繁体   English

xcodebuild存档在添加自定义构建设置时会生成格式错误的xcarchive

[英]xcodebuild archive generates malformed xcarchive when adding custom build settings

I'm trying to generate an xcarchive using xcodebuild that I can later export as an .ipa using the new functionality added with Xcode 5. 我正在尝试使用xcodebuild生成一个xcarchive,我稍后可以使用添加了Xcode 5的新功能将其导出为.ipa。

This works perfectly fine: 这非常好用:

xcodebuild -workspace 'MyWorkspace.xcworkspace' -scheme 'MyScheme' -configuration 'Release' -archivePath tmp.xcarchive archive
xcodebuild -exportArchive -exportFormat IPA -archivePath tmp.xcarchive -exportPath app.ipa -exportWithOriginalSigningIdentity

But as soon as I add custom build settings to the archive command: 但是只要我将自定义构建设置添加到archive命令:

-derivedDataPath build SYMROOT=build/build.sym DSTROOT=build/build.dst OBJROOT=build/build.obj SHARED_PRECOMPS_DIR=build/build.pch

The .xcarchive generated is empty, but there is no error. 生成的.xcarchive为空,但没有错误。

Any ideas? 有任何想法吗?

For me, this had to do with the Installation Directory Deployment Build Setting in Xcode: CMake somehow set this to "" , ie an empty string, when it should have been "/Applications" , the Xcode default. 对我来说,这与Xcode中的Installation Directory部署构建设置有关:CMake以某种方式将其设置为"" ,即空字符串,当它应该是"/Applications" ,Xcode默认。 For me, setting it to anything else than "/Applications" caused the resulting archive to be empty and therefore 'malformed'. 对我来说,将其设置为"/Applications"以外的任何内容都会导致生成的存档为空,因此“格式错误”。

So maybe your project somehow did not have Installation Directory set to "/Applications" , either because of CMake or something else. 因此,您的项目可能因为CMake或其他原因而无法将Installation Directory设置为"/Applications"

To set this using CMake, add this to your target properties: 要使用CMake进行设置,请将其添加到目标属性:

set_target_properties(${MODULE} PROPERTIES
     ...
     XCODE_ATTRIBUTE_INSTALL_PATH "/Applications"
     ...
)

For me this error happened when I had no space left on the drive where I tried to create the archive. 对我来说,当我尝试创建存档的驱动器上没有剩余空间时,会发生此错误。 But I could not tell that from the errors int he console 但我无法从控制台的错误中分辨出来

In my case the 'archivepath' directory/file path was incorrectly set in previous steps, and it was looking into a directory which did not have .xcarchive file. 在我的情况下,'archivepath'目录/文件路径在前面的步骤中设置不正确,它正在查找没有.xcarchive文件的目录。 Worth checking manually the paths and if the archive file exists in the directory 值得手动检查路径以及目录中是否存在存档文件

就我而言,我在路径末尾错过了.xcarchive扩展。

xcodebuild -exportArchive -archivePath /<path_to_archive>/file.xcarchive ...

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

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