其实也就三个步骤,但是就是这三个步骤也算是爬坑爬出来的。 现在用xcode 8.3 版本的,里面很多都更新了,而苹果的xcodebuild用法还没有更新。所以就自己找找网上的一个一个试出来的。闲话不说了,上干货。。。。。。
自己工程用到的:
1.清空工程
xcodebuild -project $Project_Path -configuration Release -target $targerName clean
2.编译
xcodebuild archive -project $Project_Path -configuration Release -scheme $targerName -archivePath ${compiled_path}/${platformname}.xcarchive CODE_SIGN_IDENTITY=$signing PROVISIONING_PROFILE=$profileUuid
3.打包
xcodebuild -exportArchive -archivePath ${compiled_path}/${platformname}.xcarchive -exportPath ${ipa_path}/test.ipa -exportOptionsPlist ${TargetPath}/exportConfig.plist
说一下里面的含义吧
$Project_Path:工程路径
$targerName: 工程里面target的名称
$signing: "打包证书的名称"
$profileUuid:打包配置的uuid
exportConfig.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>compileBitcode</key>
<false/>
<key>method</key>
<string>development</string>
</dict>
</plist>
method有4种:development,app-store,ad-hoc,enterprise 主要就是打出四种包的方式
xcodebuild的主要介绍可以参考:
https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html
xcodebuild的运用可以参考:
http://blog.csdn.net/potato512/article/details/52172107