美文网首页
iOS自动打包

iOS自动打包

作者: KKK_air | 来源:发表于2017-09-21 10:11 被阅读14次

背景:

iTunes 12.7.0 不再内嵌app store,导致之前的打测试包方式不能再继续使用,这两天没事研究了下,记录如下。

开发环境:macOS 10.12.6 xcode 8.3.3

1.clean 项目

现在的项目使用cocoapods,命令如下,
xcodebuild clean -workspace ${scheme}.xcworkspace -scheme ${scheme} -configuration Debug

-workspace (使用cocoapods)
-projcet 

-scheme <schemeName>

2.build

xcodebuild archive -workspace ${scheme}.xcworkspace -scheme ${scheme} -archivePath ${archivePath}/${scheme}.xcarchive

 -archivePath PATH

3.导出IPA文件

xcodebuild -exportArchive -archivePath ${archivePath}/${scheme}.xcarchive -exportPath ${archivePath}/${scheme} -exportOptionsPlist ${exportOptionList}

-exportPath 导出文件是一个文件夹,比如这里写 test,实际的结果是 test/test.ipa

exportOptionList 是一个plist文件,可通过xcodebuild -help查看,
teamID和method是必须的两个参数

<?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>teamID</key>
    <string>xxxx</string>
    <key>method</key>
    <string>development</string>
</dict>
</plist>

4.上传到蒲公英
ipaPath 本地IPA文件路径
ukey ,_api_key 蒲公英上传参数(获取地址https://www.pgyer.com/doc/api#uploadApp

curl -F "file=@$ipaPath" \
-F "uKey=$ukey" \
-F "_api_key=$_api_key" \
-F "installType=2" \
https://qiniu-storage.pgyer.com/apiv1/app/upload

参考文章:
http://www.jianshu.com/p/3f43370437d2
http://www.jianshu.com/p/2247f76404eb
http://www.jianshu.com/p/50e27f5799f7

相关下载地址:
https://github.com/tianxie2002/archive

相关文章

网友评论

      本文标题:iOS自动打包

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