通过 altool 上传 App 的二进制文件
https://help.apple.com/itc/apploader/#/apdATD1E53-D1E1A1303-D1E53A1126
如何生成 App 专用密码
https://support.apple.com/zh-cn/HT204397
#!/bin/sh
# =============== 配置 ===============
# ipa文件完整路径
allPath="/Users/user/Desktop/app.ipa"
# 账号数组
accont_arr=(
"apple账号"
"zapple账号2"
)
# 专用密码数组
# 如何生成 App 专用密码 https://support.apple.com/zh-cn/HT204397
pasword_arr=(
"XXXX-XXXX-XXXX-XXXX"
"XXXX-XXXX-XXXX-XXXX"
)
# ==============================
if test $[${#accont_arr[@]}] -ne $[${#pasword_arr[@]}];then
echo "\033[33;1m 账号密码数量不一致 \033[0m"
exit 0
fi
for(( i=0;i<${#accont_arr[@]};i++)) do
dengYu=" = "
logValue=${i}${dengYu}${accont_arr[i]}
echo "\033[32;1m$logValue\033[0m"
done;
read readNumbwe
if [[ -z $readNumbwe ]];then
readNumbwe=0
echo "$readNumbwe"
fi
accont=${accont_arr[readNumbwe]}
pasword=${pasword_arr[readNumbwe]}
uploadFunc(){
echo "所有参数 = $*"
echo "参数个数 = $#"
# echo "查看方法返回值 = $?"
accont=$1
pasword=$2
allPath=$3
# 验证
echo "\033[32;1m开始验证\033[0m"
xcrun altool --validate-app -f $allPath -t iOS -u $accont -p $pasword
result=$?
texr="0"
echo "验证结果 = $result"
echo "比较数值 = $[$texr]"
if [ $result -eq $texr ];then
echo "✅ ✅ 验证成功 ✅ ✅ "
else
echo "❌ ❌ 验证失败 ❌ ❌ "
exit 0
fi
# 上传
xcrun altool --upload-app -f $allPath -t iOS -u $accont -p $pasword
resultNew=$?
echo "验证结果 = $resultNew"
echo "验证结果 = $[$texr]"
if [ $resultNew -eq $texr ];then
echo "✅ ✅ ✅ 上传成功 ✅ ✅ ✅"
else
echo "❌ ❌ ❌ 上传失败 ❌ ❌ ❌"
fi
exit 0
}
uploadFunc $accont $pasword $allPath