美文网首页
Xcode升级8.3后xcodebuild打包脚本报错及解决方法

Xcode升级8.3后xcodebuild打包脚本报错及解决方法

作者: BayLite | 来源:发表于2017-05-23 18:54 被阅读0次

问题描述:

Xcode升级8.3后原本打包、导出、上传都没有问题的脚本总是能够正常打包,但是导出时总是报错。查看报错信息为:


图 1. 导出错误报错信息

问题分析:

找到打包脚本中导出的指令为:


图 2. 原打包脚本中的导出指令

在终端输入man xcodebuild后,查找exportFormat,没有找到相应参数,看来是不支持这个参数了。
查找exportArchive参数得到如下说明:


图 3. 关于exportArchive参数的说明
这样问题就很清楚了,按照手册中的格式修改脚本中的导出指令就可以了。
参数都很好理解,其中archivePath参数后跟的是打包生成的.xarchive文件的路径,exportPath参数后跟的是导出的.ipa文件的路径,exportOptionPlist后跟的是导出时的选项信息plist文件。

而这个包含选项信息的plist文件常用的key有如下两个:

method : String
Describes how Xcode shouldexportthe archive. Available options: app-store, ad-hoc, package, enterprise, development, and developer-id. The list of options varies based on thetypeof archive. Defaults to development.
teamID : String
The Developer Portal team to useforthis export. Defaults to the team used to build the archive.

这两个参数指定了在导出ipa包时的包类型和所使用的证书,其实是与手动archive并导出包时的如下两步操作对应:
其中method参数对应的是如下操作:

图 4. 手动打包时指定的包类型

teamID的指定对应于如下操作:


图 5. 手动打包时证书的选取

如下是我们项目中用到的plist文件示例:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>method</key>
    <string>enterprise</string>
    <key>teamID</key>
    <string>YourTeamIDHere</string>
</dict>
</plist>

其中method和teamID对应的value可以根据实际情况进行修改。
要保证teamID一定是正确的,否则一般会报如下错误:

xcodebuild[2019:1955788] [MT] IDEDistribution: -[IDEDistributionProvisioning _itemToSigningInfoMap:]: Can't find any applicable signing identities for items:

参考文献:
http://fight4j.github.io/2016/11/21/xcodebuild/

相关文章

网友评论

      本文标题:Xcode升级8.3后xcodebuild打包脚本报错及解决方法

      本文链接:https://www.haomeiwen.com/subject/ledgxxtx.html