1、创建xxx.plist文件
plist文件内容dict 内容
<dict>
<key>provisionProfiles</key>
<key>buildleID</key>
<string>xxx.app.com</string>
<key>uploadSymbols</key>
<key>compileBitcode</key>
method
app-store
</dict>
2、cd到工程目录,clean一下你的工程
xcodebuild clean -project(workspace) TARGET_NAME.xcodeproj(TARGET_NAME.xcworkspace) -scheme TARGET_NAME -configuration BUILD_TYPE(debug or release)
3、archive导出.xcarchive文件
xcodebuild archive -project(workspace) TARGET_NAME.project(TARGET_NAME.xcworkspace) -scheme TARGET_NAME -archivePath {ARCHIVEPATH}
ARCHIVEPATH : 一般在同级创建的bin目录下 如: bin/xxx.archive
4、出ipa包
xcodebuild -exportArchive -archivePath bin/TARGET_NAME.xcarchive -exportPath EXPORTPATH(目标路径) -exportOptionsPlist EXPORTOPTIONSPLIST(创建的plist文件)
二、快捷方式
到工程根目录,创建bin文件夹并创建plist文件(和第一步一样)
vim xxx.sh 脚本文件,内容如下
project_name='xxx'
#workspace 或者project
project_type='workspace'
#configuration 可选Debug或者Release
configurationType='Release'
project_fullName=""$project_name".xc"$project_type""
#package_path
#打包在bin目录下
archive_path="./bin/"
#plist文件名内容提前填充好
exportOptionsPlist_name='exportOptionsPlist.plist'
exportOptionsPlistPath=""$archive_path""$exportOptionsPlist_name""
#clean project
clean_commond='xcodebuild clean'
$clean_commond
#build project
build_commond="xcodebuild -scheme "$project_name" -"$project_type" "$project_fullName" -configuration "$configurationType""
$build_commond
#archive project
archive_commond="xcodebuild archive -scheme "$project_name" -"$project_type" "$project_fullName" -configuration "$configurationType" -archivePath "$archive_path""$project_name""
$archive_commond
#exportArchive
exportArchive_commond="xcodebuild -exportArchive -archivePath "$archive_path""$project_name".xcarchive -exportPath "$archive_path" -exportOptionsPlist "$exportOptionsPlistPath""
$exportArchive_commond
注释: xxx 为项目名称 该脚本已.xcodeproj为例,如果是xcworkspace则改为xcworkspace即可,
configuration 为 可自行设置debug or release
编辑好后执行
./xxx.sh
如果遇到permision dined, 执行
sudo chmod 777 xxx.sh
再执行 ./xxx.sh 即可
plist文件内容,修改 xxx.app.com 为自己项目的buildleID 即为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>provisionProfiles</key>
<dict>
<key>buildleID</key>
<string>xxx.app.com</string>
<key>uploadSymbols</key>
<true/>
<key>compileBitcode</key>
<false/>
<key>method</key>
<string>app-store</string>
</dict>
</dict>
</plist>
以上是本人命令行打包总结,Hope it helps!
网友评论