通过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)
相关推荐
黑客-秋凌1 小时前
软件测试面试会问的测试用例设计方法
自动化测试·软件测试·自动化·测试用例
豆豆的java之旅2 小时前
深入浅出Activity工作流:从理论到实践,让业务流转自动化
java·运维·自动化·activity·工作流
整列机厂家-东莞唯思特3 小时前
破解喷涂治具精准上料难题:唯思特整列机在汽车零部件行业的创新应用实录
科技·自动化·制造
YongCheng_Liang9 小时前
深度解析:GitHub API 爬虫工具 —— 自动化获取热门 / 推荐开源项目
爬虫·自动化·github
ycydynq15 小时前
自动化验证码实现
爬虫·自动化
w***Q35015 小时前
Git工作流自动化
运维·git·自动化
吠品15 小时前
免费SSL证书自动化申请:DNS代理验证
网络协议·自动化·ssl
霍格沃兹软件测试开发20 小时前
Playwright MCP浏览器自动化指南:让AI精准理解你的命令
运维·人工智能·自动化
1***y1781 天前
Git在发布流程中的自动化标签
运维·git·自动化
dntktop1 天前
搜索+计算+插件…这个“全能管家”让你告别80%的桌面图标
运维·windows·自动化·编辑器