移动开发干货店

使用iTMSTransporter上传ipa包到AppStore

2023-07-23  本文已影响0人  Jackson_Z

iTMSTransporter工具下载地址:
Windows
OSX
Linux

iTMSTransporter --help upload可以查看upload的具体用法

几个重要参数说明

  1. -m 模式(mode) 有很多,我们用到的就几个,provider 查看公司主体和teamId,verifyuploadstatus or -m statusAll,查看ipa上传进度情况

2.-f指定.itmsp数据包,其实就是一个带itmsp后缀的文件夹,里面包含2个文件,一个是待上传的ipa文件,一个是元数据文件,叫作metadata.xml,文件内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<package version="software5.10" xmlns="http://apple.com/itunes/importer">
    <software_assets apple_id="{apple_id}" app_platform="{app_platform}">
        <asset type="{archive_type}">
            <data_file>
                <size>{file_size}</size>
                <file_name>{file_name}</file_name>
                <checksum type="md5">{file_md5}</checksum>
            </data_file>
        </asset>
    </software_assets>
</package>

{apple_id}就是苹果`appstoreconnect`创建app后,链接中显示的id
{app_platform}为ios
{archive_type}为bundle
{file_size}为ipa文件大小, 可以通过 `ls -l xxx.ipa`来获取
{file_name}ipa文件名,xxx.ipa
{file_md5}ipa文件md5,通过`md5 xxx.ipa`获取

例子

<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://apple.com/itunes/importer" version="software5.4">
  <software_assets apple_id="6450033162" app_platform="ios">
    <asset type="bundle">
      <data_file>
        <size>99526807</size>
        <file_name>mx3flutter138.ipa</file_name>
        <checksum type="md5">ab5b221fcad3c1bcd471fe22c48e0677</checksum>
      </data_file>
    </asset>
  </software_assets>
</package>

3.-assetFile指定ipa文件,最好用全路径

  1. -u苹果账号

5.-p专用密码,在appldid.apple.com创建
6.-asc_provider 就是teamId,通过xcrun altool --list-providers -u user -p password或者iTMSTransporter -m provider -u user -p password -v eXtreme获取,
7.-assetDescription windows和Linux必须指定,是一个plist文件,一般叫AppStoreInfo.plist,大概4M左右,必需用全路径,不然报错The asset description specified is not a file: AppStoreInfo.plist

image.png
AppStoreInfo.plist
// 在ExportOptions.plist添加generateAppStoreInformation 值为 true,通过一下命令会生成AppStoreInfo.plist文件
xcodebuild -exportArchive -archivePath xxx.xcarchive -exportOptionsPlist ExportOptions.plist -exportPath ./output

也可以通过下面命令来生成

xcrun swinfo -f xxx.ipa -o AppStoreInfo.plist -plistFormat binary -prettyprint true

verify

iTMSTransporter -m verify -u $user -p $password -asc_provider $teamId -v eXtreme -f xxx.itmsp

upload

assetDescription 苹果电脑可不指定,windows和Linux必需传,必需用全文件路径,不然报错The asset description specified is not a file: AppStoreInfo.plist

1.通过密码上传

iTMSTransporter -m upload -u $user -p $password -asc_provider $teamId -v eXtreme -assetFile xxx.ipa -assetDescription D:\11\AppStoreInfo.plist

2.通过密钥上传

iTMSTransporter -m upload -apiIssuer c4538051-xxxx-xxxx-xxxx-afb7ffe2e1dc -apiKey 8W473MVR9D -v eXtreme -assetFile xxx.ipa -assetDescription D:\11\AppStoreInfo.plist

可在 App Store Connect 中前往“用户和访问”部分的“密钥”创建密钥,
当前目录创建private_keys文件夹,里面放AuthKey_<apiKey value>.p8文件,详见apiKey参数

3.通过JWT上传

iTMSTransporter -m upload -jwt "xxx" -v eXtreme -assetFile xxx.ipa -assetDescription D:\11\AppStoreInfo.plist

jwt值文件可在https://jwt.io/生成(要传公钥,我没生成成功),具体参数见 Generating Tokens for API Requests,可以通过python库 appstore_tools生成

from appstore_tools import appstore, actions

with open("AuthKey.p8", "r") as file:
    key = file.read()

issuer_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
key_id="XXXXXXXXXX"

# Create an access token
access_token = appstore.create_access_token(
    issuer_id=issuer_id, key_id=key_id, key=key
)

status or statusAll

iTMSTransporter -m status -u $user -p $password -v eXtreme -apple_id 6450033162

lookupMetadata

iTMSTransporter -m lookupMetadata -u $user -p $password -asc_provider $teamId -v informational -apple_id 6450033162 -destination out/

https://help.apple.com/itc/transporteruserguide/
https://help.apple.com/itc/transporteruserguide/en.lproj/static.html

上一篇下一篇

猜你喜欢

热点阅读