- 清理
xcodebuild clean -workspace YourProjectName.xcworkspace -scheme YourProjectName -configuration Release
- 编译
xcodebuild -workspace YourProjectName.xcworkspace -scheme YourProjectName -archivePath build/YourProjectName.xcarchive archive
- 打包
xcodebuild -exportArchive -archivePath build/YourProjectName.xcarchive -exportPath build -exportOptionsPlist export.plist
export.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>ad-hoc</string>
<key>provisioningProfiles</key>
<dict>
<key>llqqb.borrowMoney</key>
<string>yxbAdHoc</string>
</dict>
<key>signingCertificate</key>
<string>iPhone Distribution</string>
<key>signingStyle</key>
<string>automatic</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>5J784PXPGS</string>
<key>thinning</key>
<string><none></string>
</dict>
</plist>
method
: 打的包的类型(development
,ad-hoc
,app-store
,enterprise
)provisionProfiles
: 项目的包名和对应ProvisionProfiles文件名signingCertificate
: 是否是开发环境还是生产环境teamID
: TeamID(通过AppleDeveloper查看)