iOS 命令行打包

以下以 ad-hoc 的 ipa 为例.

1. 保证在 xcode 中可以正常的打包和导出

在 xcode 可以正常的打包和导出, 还不一定行, 要保证 TARGETS 列表中的所有 target 都是统一的 Code Sign.

保证每一个 target 配置是的证书要是一样的.

Build Settings --> Signing --> Code Signing IdentitySigning & Capabilities 配置没有问题, profile 都是 统一的(这里都是 ad-hoc)

2. 打包命令

2.1 查看你的 Schema

xcodebuild "-workspace" "/YOUR/PROJECT/PATH/ios/YOUR_PROJECT.xcworkspace"

会列出所有的 Shcema, 选择你要打包的那个, 和我们在xcode中看到的项目一样的那个

2.2 打包

和 xcode 中的 Product --> Archive 是一样的

xcodebuild "-workspace" "/YOUR/PROJECT/PATH/ios/YOUR_PROJECT.xcworkspace" "-scheme" "YOUR_SCHEMA" -destination 'generic/platform=iOS' "clean" "archive" "-archivePath" "/OUTPUT/PATH/archive/YOUR_SCHEMA.xcarchive"

里面的路径改成你的路径, YOUR_SCHEMA 改成你的 schema.

如果没有加 -destination 'generic/platform=iOS' 会有以下错误:

error: Provisioning profile "com.xxx.xxx.xxx" doesn't include the currently selected device "xxxxxxx’s Mac" (identifier 00008000-001D598901XXXXXX). (in target 'YOUR_SCHEMA' from project 'YOUR_SCHEMA')

** ARCHIVE FAILED **

2.3 到处 ipa

xcodebuild -exportArchive -archivePath /OUTPUT/PATH/archive/YOUR_SCHEMA.xcarchive -exportPath /OUTPUT/PATH/export -exportOptionsPlist /EXPORT_OPTIONS/PATH/ExportOptions.plist

ExportOptions.plist 可以使用 xcode 导出的目录中的.

好文阅读

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: