【问题描述】
开发在一次合并之后,能正常打包的 iOS app 突然罢工了,xcodebuild archive 正常,可是 export archive 的时候就报错,提示:No applicable devices found.
详细报错如下:
** ARCHIVE SUCCEEDED **
2017-02-15 17:30:42.235 xcodebuild[40487:12742675] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/pc/gsn5_b390x7b6xdf1cgltcr80000gn/T/Uplus_2017-02-15_17-30-42.234.xcdistributionlogs'.
2017-02-15 17:30:56.853 xcodebuild[40487:12742675] [MT] IDEDistribution: Step failed: <IDEDistributionThinningStep: 0x7fd80ef102b0>: Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found." UserInfo={NSLocalizedDescription=No applicable devices found.}
error: exportArchive: No applicable devices found.
Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found." UserInfo={NSLocalizedDescription=No applicable devices found.}
** EXPORT FAILED **
【出错分析】
之前碰到过 xcodebuild build 的时候,报 “No applicable devices found” 的错误,加了参数 -destination generic/platform=iOS 就好了。这次试了不行;
网上说的 ruby 版本的解释,也行不通;
后来想查 git log, 发现这次合并的东西实在太多了,也不好检查。
最后仔细看了看出错的日志,其中有一个日志路径,就进去看了看:
Created bundle at path'/var/folders/pc/xxx/T/xx_2017-02-15_17-30-42.234.xcdistributionlogs'.
这个目录下有四个文件:
IDECodesignResolver.log IDEDistribution.critical.log IDEDistribution.standard.log IDEDistribution.verbose.log
默认打包 console output 输出的是 IDEDistribution.critical.log,检查了一下 IDEDistribution.standard.log,才恍然大悟:
error: Info.plist of “xxx.app/H5PresetResource.bundle/Contents” specifies a non-existent file for the CFBundleExecutable key
【解决方法】
这下就好办了,找到这个文件,把这个 key 删除就好了。