Unity打包IOS自动发布fir.im

打包流程

  1. 配置fir-cli,可以到github查看围挡
  2. Unity中,设置AutoSign为false
    • 后边autosign下会导致shell指定ProvisioningProfile失败,从而导致签名失败
  3. Unity中,导出xcode项目
  4. 使用shell脚本,使用xcodebuildArchive,导出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>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值