通过shell脚本上传IPA

之前一直使用的altools.最近因为过期需要迁移到notarytool.本片文章介绍一下该脚本如何使用

altool的使用(旧版)

假如你的Xcode的路径是下面的路径:

复制代码
/Applications/Xcode.app

那么之前使用到的工具的路径就是下面的路径:

复制代码
/Applications/Xcode.app/Contents/Developer/usr/bin/altool

APPLEACCOUNT = "xxx@xx.com" # 替换为你的账号
APPLEPASSWORD = "123123123" # 替换为你的密码(这里建议在appleid.com中创建一个单独密码来专门使用)
EXPORT_IPA = "/xx/xx/xx.ipa" #替换为要上传的ipa路径
1. 验证ipa
xcrun altool -v -f ${EXPORT_IPA} -u ${APPLEACCOUNT} -p ${APPLEPASSWORD} -t ios
2. 上传ipa包
xcrun altool --upload-app -f ${EXPORT_IPA} -u ${APPLEACCOUNT} -p ${APPLEPASSWORD} -t ios

notarytool的使用

Xcode版本 >= Xcode13

shell

复制代码
APPLEACCOUNT = "xxx@xx.com" # 替换为你的账号
APPLEPASSWORD = "123123123" # 替换为你的密码(这里建议在appleid.com中创建一个单独密码来专门使用)
EXPORT_IPA = "/xx/xx/xx.ipa" #替换为要上传的ipa路径
APPLETEAMID = "xxxxxx" # 替换为developer网站中对应团队member中显示的的teamid
1. 上传IPA包
xcrun notarytool submit {EXPORT_IPA} --apple-id {APPLEACCOUNT} --team-id {APPLETEAMID} --password {APPLEPASSWORD} --wait
2. 查看上传结果
xcrun notarytool history --apple-id {APPLEACCOUNT} --team-id {APPLETEAMID} --password {APPLEPASSWORD}

python

复制代码
..
import subprocess
...
APPLEACCOUNT = "xxx@xx.com" # 替换为你的账号
APPLEPASSWORD = "123123123" # 替换为你的密码(这里建议在appleid.com中创建一个单独密码来专门使用)
EXPORT_IPA = "/xx/xx/xx.ipa" #替换为要上传的ipa路径
APPLETEAMID = "xxxxxx" # 替换为developer网站中对应团队member中显示的的teamid
...
upload_script = f"{notarytool} submit {EXPORT_IPA} --apple-id {APPLEACCOUNT} --team-id {APPLETEAMID} --password {APPLEPASSWORD} --wait"
upload_output = subprocess.Popen(upload_script, stdout=subprocess.PIPE, shell=True)
upload_log = upload_output.stdout.read().decode()
upload_output.wait()
if upload_output.returncode == 0:
	print("AppStore上传成功:\n" + upload_log)
else:
	print(""AppStore上传失败:\n" + upload_log)
# 查看上传结果
upload_result_script = f"{notarytool} history --apple-id {APPLEACCOUNT} --team-id {APPLETEAMID} --password {APPLEPASSWORD}"
upload_result_output = subprocess.Popen(upload_result_script, stdout=subprocess.PIPE, shell=True)
upload_result_log = upload_result_output.stdout.read().decode()
upload_result_output.wait()
if upload_result_output.returncode == 0:
	print("AppStore上传状态查询成功:\n" + upload_result_log)
else:
	print("AppStore上传状态查询失败:\n" + upload_result_log)
相关推荐
七夜zippoe7 小时前
破解 VMware 迁移难题:跨平台迁移常见问题及自动化解决方案
运维·自动化·vmware
Listennnn12 小时前
Agent自动化与代码智能
人工智能·自动化
爱分享的飘哥16 小时前
第十九篇 自动化报表生成:Python一键生成可视化Excel图表与专业PDF报告,老板看了都点赞!
自动化·办公自动化·数据可视化·excel自动化·python报表·pdf报告
特种加菲猫21 小时前
构建完整工具链:GCC/G++ + Makefile + Git 自动化开发流程
linux·笔记·git·自动化
王者鳜錸1 天前
使用Selenium自动化获取抖音创作者平台视频数据
selenium·自动化·音视频
chao_7891 天前
frame 与新窗口切换操作【selenium 】
前端·javascript·css·selenium·测试工具·自动化·html
LCG元1 天前
基于MCP的CI/CD流水线:自动化部署到云平台的实践
运维·ci/cd·自动化
I'mSQL1 天前
C#与FX5U进行Socket通信
运维·服务器·自动化·wpf
人机与认知实验室2 天前
自动化与智能化
运维·人工智能·自动化
cpsvps2 天前
香港服务器Python自动化巡检脚本开发与邮件告警集成
服务器·python·自动化