打包流程
- 配置fir-cli,可以到github查看围挡
- Unity中,设置AutoSign为false
- 后边autosign下会导致shell指定ProvisioningProfile失败,从而导致签名失败
- Unity中,导出xcode项目
- 使用shell脚本,使用
xcodebuild
Archive,导出ipa包,并使用fir-cli
上传到fir.im
- 打包需要指定
exportOptionsPlist
参数,可以通过xcode的新建一个plist进行填写
- 打包需要指定
脚本
shell文件
shell文件保存为xxx.sh。需要用chmod +x xxx.sh
附加权限
根据自己的需求,修改下边的路径和参数。
!如果unity打包出来的是workspace工程,如GVR项目。需要对Archive部分进行修改
# 项目名
project_name="Unity-iPhone"
# 打包出来的根目录
build_root="/Users/xx/xxxxxxxx/xxxxx/Build"
# xcodeproj所在的相对目录
build_dir="xxxxx"
# exportOptionsPlist
export_plist="xxx/xxxx.plist"
# 证书
# 在keychain复制标题即可
code_sign="iPhone Distribution: xxx xx (xxxxxxxxxx)"
# Provisioning Profile uuid
# 建议通过显示xcodeproj包内容,在其中的project.pbxproj中查找
# PROVISIONING_PROFILE相关字段,找到对应的UUID
ppuuid="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
# fir短地址
fir_shot="xxxx"
# fir开发Token
fir_token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# 进入xcode目录下
cd ${build_root}/${build_dir}
echo "*************"
echo "clean start"
echo "*************"
# 清理打包过程中间产物
xcodebuild clean
echo "*************"
echo "clean start"
echo "*************"
echo "*************"
echo "Build start"
echo "*************"
# archive
xcodebuild archive \
-project ./${project_name}.xcodeproj \
-scheme ${project_name} \
-archivePath ../build_output/${project_name}.xcarchive \
CODE_SIGN_IDENTITY="${code_sign}" \
PROVISIONING_PROFILE="${ppuuid}"
echo "*************"
echo "Build Finished"
echo "*************"
echo "*************"
echo "exportArchive start"
echo "*************"
# export ipa
xcodebuild \
-exportArchive \
-archivePath ../build_output/${project_name}.xcarchive \
-exportPath ../build_output/${project_name} \
-exportOptionsPlist ${export_plist} \
CODE_SIGN_IDENTITY="${code_sign}" \
PROVISIONING_PROFILE="${ppuuid}"
echo "*************"
echo "exportArchive Finished"
echo "*************"
echo "*************"
echo "fir start"
echo "*************"
# 上传fir
fir p ../build_output/${project_name}/${project_name}.ipa -s ${fir_shot} -Q -v --token=${fir_token}
echo "*************"
echo "fir Finished"
echo "*************"
Export配置plist
xcodebuild -exportArchive
命令现在要求必须要有-exportOptionsPlist
参数用来设置Export的配置。
下边是一份ad-hoc的配置表。
<?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>teamID</key>
<string>xxxxxxxxxx</string>
<key>method</key>
<string>ad-hoc</string>
<key>uploadBitCode</key>
<false/>
<key>compileBitcode</key>
<false/>
</dict>
</plist>