之前使用xcodebuild时,一直用 -exportFormat 指定输出格式后打包. 上周升级到Xcode 8.3后发现打包一直失败,原来是在Xcode8.3中这个选项被弃用了,新的选项是-exportOptionsPlist.其实也不是新的选项,这个选项在Xcode 7的时候就已经有了,只是-exportFormat还可以用而已.
xcodebuild -exportOptionsPlist 后面跟上path,path就是一个指定了导出ipa配置参数的plist文件路径.
这个plist可用的key-value值,我总结出了下面的一个列表
| key | Type | kind | default | Used for |
|---|---|---|---|---|
| method | String | app-store, ad-hoc, package, enterprise, development, and developer-id. | development | All |
| teamID | String | teamID | Defaults to the team used to build the archive | All |
| uploadBitcode | Bool | YES,NO | YES | AppStore |
| uploadSymbols | Bool | YES,NO | YES | AppStore |
| compileBitcode | Bool | YES,NO | YES | non-App Store |
| iCloudContainerEnvironment | String | Development, Production. | Development | non-App Store |
| embedOnDemandResourcesAssetPacksInBundle | Bool | YES,NO | YES | non-App Store |
| onDemandResourcesAssetPacksBaseURL | String | A base URL for the app to download asset packs. | non-App Store | |
| manifest | Dictionary | appURL, displayImageURL, fullSizeImageURL, assetPackManifestURL(when using on demand resources) | non-App Store | |
| thinning | String | <none>, <thin-for-all-variants> , "iPhone7,1" | <none> | non-App Store |
- 如果使用的是gym,method需要改成export-method
- 如果设置
embedOnDemandResourcesAssetPacksInBundle为YES,onDemandResourcesAssetPacksBaseURL的值会被忽略 -
assetPackManifestURL仅在onDemandResourcesAssetPacksBaseURL生效的时候可用
最后附一个新的命令
xcodebuild -exportArchive
-exportOptionsPlist ~/Code/bluelich-dev.plist
-archivePath ~/Desktop/bluelich.xcarchive
-exportPath ~/Desktop/bluelich_dev