xcodebuild error: exportArchive: Found an unexpected Mach-O header code

错误详情描述

ios打包时,"** ARCHIVE SUCCEEDED **"成功了,但是从"..xcarchive"文件导出"ipa"文件时(即xcodebuild -exportArchive),却报错,如下:

xcodebuild[49559:8399880] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/zp/bhhpqy8x5l79szqgq4kk5h640000gn/T/OKEx_2019-01-11_20-34-38.381.xcdistributionlogs'.
2019-01-11 20:34:39.109 xcodebuild[49559:8399880] [MT] IDEDistribution: Failed to generate distribution items with error: Error Domain=DVTMachOErrorDomain Code=0 "Found an unexpected Mach-O header code: 0x72613c21" UserInfo={NSLocalizedDescription=Found an unexpected Mach-O header code: 0x72613c21, NSLocalizedRecoverySuggestion=}
error: exportArchive: Found an unexpected Mach-O header code: 0x72613c21

Error Domain=DVTMachOErrorDomain Code=0 "Found an unexpected Mach-O header code: 0x72613c21" UserInfo={NSLocalizedDescription=Found an unexpected Mach-O header code: 0x72613c21, NSLocalizedRecoverySuggestion=}

** EXPORT FAILED **

里面最关键的一句是:“error: exportArchive: Found an unexpected Mach-O header code: 0x72613c21”

网上其他的解决办法

网上有些说是因为 “Embedded Binaries”里包含了静态库,
解决办法:将 Embedded Binaries 中的静态库移到 Linked Frameworks and Libraries 中;

我的解决办法

我这并不是因为“Embedded Binaries”里包含了静态库;
我使用了cocoapods,我的资源目录里有一些bundle文件和静态framework文件,在“podspec”文件里设置“resource_bundles”字段时不小心使用了通配符,导致项目的 "target"-"Build Phases"-"Copy Bundle Resources"里加入了framework文件,最终把这个framework拷贝到了".app"里(也可能在.app的一些bundle文件内部),
在xcode正常的debug编译时不会出现问题,但是到打包发布时,问题就出现了:
第一步archive时,是正常的;
第二步export时,检测到.app里包含非常规的静态framework文件时,就会报上面的错误“error: exportArchive: Found an unexpected Mach-O header code: 0x72613c21”;

注意".app"目录下的“Frameworks”是可以包含动态framework的

**解决办法:**当然把"Copy Bundle Resources"里的framework去掉即可

转载于:https://my.oschina.net/shede333/blog/3000451

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值