Xcode11的altool上傳IPA包

升級xcode11后冰蘑,你會發(fā)現(xiàn)找不到Application loader這個工具了。而Application loader只是對altool的封裝。
去查看xcdoe11的更新說明邪铲,有這樣一段話

Xcode supports uploading apps from the Organizer window or from the command line with xcodebuild or xcrun altool. Application Loader is no longer included with Xcode. (29008875)

新版altool資料:

MacBook-Pro:~ $ xcrun altool
Copyright (c) 2009-2019, Apple Inc. Version 4.00.1181

Usage: altool --validate-app -f <file> -t <platform> -u <username> {[-p <password>] | --apiKey <api_key> --apiIssuer <issuer_id>}
       altool --upload-app -f <file> -t <platform> -u <username> {[-p <password>] | --apiKey <api_key> --apiIssuer <issuer_id>}
       altool --notarize-app -f <file> --primary-bundle-id <bundle_id> -u <username> {[-p <password>] | --apiKey <api_key> --apiIssuer <issuer_id>} [--asc-provider <provider_shortname>]
       altool --notarization-info <uuid> -u <username> {[-p <password>] | --apiKey <api_key> --apiIssuer <issuer_id>}
       altool --notarization-history <page> -u <username> {[-p <password>] | --apiKey <api_key> --apiIssuer <issuer_id>} [--asc-provider <provider_shortname>]
       altool --list-apps -u <username> {[-p <password>] | --apiKey <api_key> --apiIssuer <issuer_id>}
       altool --store-password-in-keychain-item <name_for_keychain_item> -u <username> -p <password>

Authentication: Most commands require authorization.
                There are two methods available: user name with password, and apiKey with apiIssuer.

                -u, --username <username> Username. Required to connect for validation, upload, and notarization.
                -p, --password <password> Password. Required if username specified and apiKey/apiIssuer are not.
                                          If this argument is not supplied on the command line, it will be read from stdin.
                                          Alternatively to entering <password> in plaintext, it may also be specified using a '@keychain:'
                                          or '@env:' prefix followed by a keychain password item name or environment variable name.
                                          Example: '-p @keychain:<name>' uses the password stored in the keychain password item named <name>.
                                                                         You can create and update keychain items with the
                                                                         --store-password-in-keychain-item command.
                                          Example: '-p @env:<variable>'  uses the value in the environment variable named <variable>

                --apiKey <api_key>        apiKey. Required for JWT authentication while using validation, upload, and notarization.
                                          This option will search the following directories in sequence for a private key file
                                          with the name of 'AuthKey_<api_key>.p8':  './private_keys', '~/private_keys', '~/.private_keys',
                                          and '~/.appstoreconnect/private_keys'.
                --apiIssuer <issuer_id>   Issuer ID. Required if --apiKey is specified.

 -f, --file <file>                   <file> specifies the path to the file to process.
 -t, --type {osx | ios | appletvos}  Specify the platform of the file.

     --primary-bundle-id <bundle_id> Used with --notarize-app to uniquely identify a package.

     --asc-provider <provider_shortname> Required with --notarize-app and --notarization-history when a user account is associated with multiple
                                         providers.

 -v, --validate-app                  Validates an app archive for the App Store. Authentication and -f are required.
     --upload-app                    Uploads the given app archive to the App Store. Authentication and -f are required.
     --list-apps                     Display all apps associated with your account(s).

     --notarize-app                  Uploads the given app package, dmg or zip file for notarization. Authentication, -f,
                                     and --primary-bundle-id are required. --asc-provider is required for an account associated with multiple providers.
                                     If successful, the UUID associated with the upload is returned.

     --notarization-info <uuid>      Returns the status and log file URL of a package previously uploaded for notarization with the specified <uuid>.
                                     Authentication is required. The log file can be retrieved with 'curl <log_file_url>'.

     --notarization-history <page>   Returns a list of all uploads submitted for notarization. <page> specifies a range of entries where 0
                                     returns the most recent number of entries. A new page value will be returned which can be used as the
                                     <page> value to the next use of --notarization-history and so forth until no more items are returned.
                                     Authentication is required. --asc-provider is required for an account associated with multiple providers.

     --store-password-in-keychain-item <name_for_keychain_item> -u <username> -p <password>
                                     Stores the password <password> in the keychain item named <name_for_keychain_item> associated with the account <username>.
                                     If an item with that name and account already exists in the keychain, its password will be updated. Otherwise a new item
                                     is created with that name. You can use this keychain item with the -p option to mask your password with other commands.
                                     Example: altool --store-password-in-keychain-item MY_SECRET -u jappleseed@apple.com -p "MyP@ssw0rd!@78"
                                              altool --notarize-app -u jappleseed@apple.com -p @keychain:MY_SECRET [...]

     --output-format {xml | normal}  Specifies how the output is formatted. 'xml' displays the output in a structured format; 'normal' displays in
                                     an unstructured format (default).

     --verbose                       Enable logging output.

 -h, --help                          Display this output.

對比舊版本的altool多了2個參數(shù)--apiKey 疲憋、--apiIssuer

1.為何新版本的xcode11不支持ApplicationLoader

結(jié)合舊版本的altool渺尘,新版本的altool支持了各種文件壓縮包的上傳挫鸽,應(yīng)該就是mac、ipad鸥跟、iphone應(yīng)用和其他相關(guān)打包產(chǎn)物的集合包丢郊,而舊版本的altool只支持ipa、pkg的上傳医咨。

2.如何使用xcrun altool驗證枫匾、上傳ipa包

xcrun altool有雙重認證限制后,不能直接使用賬號密碼了腋逆,只能使用新的-apiKey 婿牍、--apiIssuer。

3.仔細查看它們的介紹:
--apiKey <api_key>        apiKey. Required for JWT authentication while using validation, upload, and notarization.
                                          This option will search the following directories in sequence for a private key file
                                          with the name of 'AuthKey_<api_key>.p8':  './private_keys', '~/private_keys', '~/.private_keys',
                                          and '~/.appstoreconnect/private_keys'.
--apiIssuer <issuer_id>   Issuer ID. Required if --apiKey is specified.

對 JWT authentication惩歉,官網(wǎng)搜索幫助信息等脂,相關(guān)的一篇介紹
簡單講就是登錄iTunesConnect --->用戶與訪問--->密鑰,至此撑蚌,生成相應(yīng)身份的密鑰上遥,再將私鑰下載下來。至此争涌,你可以明白什么是apiKey粉楚、issuser了,這個apiKey的值亮垫,就是圖中的密鑰ID模软,我們將其對應(yīng)私鑰下載下來后,需要放到一個固定目錄下饮潦,

'./private_keys'或者'~/private_keys' 或者'~/.private_keys' 或者'~/.appstoreconnect/private_keys'.
4.最終的驗證燃异、上傳的兩個命令:
xcrun altool --validate-app -f xxx/xxx/xxx.ipa -t ios --apiKey xxxxxxxx --apiIssuer xxxxxx --verbose  --output-format xml

xcrun altool --upload-app -f xxx/xxx/xxx.ipa -t ios --apiKey xxxxxxxx --apiIssuer xxxxxx --verbose  --output-format xml

2個命令分別對應(yīng) 驗證IPA 和 上傳IPA,都需要使用3個參數(shù)ipa路徑继蜡、apiKey回俐、apiIssuer

一:路徑不用說了逛腿,可以使用xcodebuild打包或用OrganizerExport導(dǎo)出App store包。
二:apiKeyapiIssuer需要去開發(fā)者官網(wǎng)-用戶和訪問-密鑰-去新增仅颇。如下圖流程
  • 新增一個密鑰单默,名稱和訪問者可以自由填寫
    api
  • 生成完成后,IssuerID就是apiIssuer忘瓦,密鑰ID就是apiKey搁廓,并且還有一個API密鑰可以下載注意此秘鑰文件只能下載一次,請妥善保存
    IssuerID
三:到這一步先別急執(zhí)行命令耕皮,執(zhí)行了也會出錯枚抵,按照xcrun altool官方文檔說明
apiKey. Required for JWT authentication while using validation, upload, and notarization.
This option will search the following directories in sequence for a private key file
with the name of 'AuthKey_<api_key>.p8':  './private_keys', '~/private_keys', '~/.private_keys',and '~/.appstoreconnect/private_keys'.

我們需要把剛才下載好的密鑰文件放到這里面的其中一個文件夾里,它會按順序去查找明场。我自己是在用戶目錄下/Users/xxx/private_keys新建了個private_keys文件夾汽摹,并把密鑰文件放進去的。

四:接下來把參數(shù)替換上去苦锨,可以嘗試進行驗證和上傳了逼泣。
  • 驗證結(jié)果:
2019-11-13 11:36:56.773 altool[3970:100440] Deallocating <ITunesSoftwareServiceWorkSeriesFactory: 0x7fa5d6d06610>
<?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>os-version</key>
    <string>10.14.6</string>
    <key>success-message</key>
    <string>No errors validating archive at '/Users/xxx/Desktop/altools.ipa'</string>
    <key>tool-path</key>
    <string>/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework</string>
    <key>tool-version</key>
    <string>4.00.1181</string>
</dict>
</plist>
2019-11-13 11:36:

等到提示No errors validating archive at xxx時就代表驗證成功了,可以上傳了舟舒。

  • 上傳結(jié)果
2019-11-13 11:49:55.382 altool[4093:102055] [2019-11-13 11:49:55 CST] <main> DBG-X: Returning 0
<?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>os-version</key>
    <string>10.14.6</string>
    <key>success-message</key>
    <string>No errors uploading '/Users/xxx/Desktop/altools.ipa'</string>
    <key>tool-path</key>
    <string>/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework</string>
    <key>tool-version</key>
    <string>4.00.1181</string>
</dict>
</plist>

等到提示No errors uploading時就代表上傳成功了拉庶,可以去開發(fā)者中心-活動里面查看一下是否有構(gòu)建版本

構(gòu)建版本

五:已經(jīng)有了,到這里就大功告成了秃励。是不是真香氏仗。。夺鲜。
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末皆尔,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子币励,更是在濱河造成了極大的恐慌慷蠕,老刑警劉巖,帶你破解...
    沈念sama閱讀 219,039評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件食呻,死亡現(xiàn)場離奇詭異流炕,居然都是意外死亡,警方通過查閱死者的電腦和手機仅胞,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,426評論 3 395
  • 文/潘曉璐 我一進店門每辟,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人干旧,你說我怎么就攤上這事渠欺。” “怎么了莱革?”我有些...
    開封第一講書人閱讀 165,417評論 0 356
  • 文/不壞的土叔 我叫張陵峻堰,是天一觀的道長。 經(jīng)常有香客問我盅视,道長捐名,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,868評論 1 295
  • 正文 為了忘掉前任闹击,我火速辦了婚禮镶蹋,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘赏半。我一直安慰自己贺归,他們只是感情好,可當(dāng)我...
    茶點故事閱讀 67,892評論 6 392
  • 文/花漫 我一把揭開白布断箫。 她就那樣靜靜地躺著拂酣,像睡著了一般。 火紅的嫁衣襯著肌膚如雪仲义。 梳的紋絲不亂的頭發(fā)上婶熬,一...
    開封第一講書人閱讀 51,692評論 1 305
  • 那天,我揣著相機與錄音埃撵,去河邊找鬼赵颅。 笑死,一個胖子當(dāng)著我的面吹牛暂刘,可吹牛的內(nèi)容都是我干的饺谬。 我是一名探鬼主播,決...
    沈念sama閱讀 40,416評論 3 419
  • 文/蒼蘭香墨 我猛地睜開眼谣拣,長吁一口氣:“原來是場噩夢啊……” “哼募寨!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起森缠,我...
    開封第一講書人閱讀 39,326評論 0 276
  • 序言:老撾萬榮一對情侶失蹤绪商,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后辅鲸,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體格郁,經(jīng)...
    沈念sama閱讀 45,782評論 1 316
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,957評論 3 337
  • 正文 我和宋清朗相戀三年独悴,在試婚紗的時候發(fā)現(xiàn)自己被綠了例书。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,102評論 1 350
  • 序言:一個原本活蹦亂跳的男人離奇死亡刻炒,死狀恐怖决采,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情坟奥,我是刑警寧澤树瞭,帶...
    沈念sama閱讀 35,790評論 5 346
  • 正文 年R本政府宣布拇厢,位于F島的核電站,受9級特大地震影響晒喷,放射性物質(zhì)發(fā)生泄漏孝偎。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 41,442評論 3 331
  • 文/蒙蒙 一凉敲、第九天 我趴在偏房一處隱蔽的房頂上張望衣盾。 院中可真熱鬧,春花似錦爷抓、人聲如沸势决。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,996評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽果复。三九已至,卻和暖如春渤昌,著一層夾襖步出監(jiān)牢的瞬間据悔,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,113評論 1 272
  • 我被黑心中介騙來泰國打工耘沼, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留极颓,地道東北人。 一個月前我還...
    沈念sama閱讀 48,332評論 3 373
  • 正文 我出身青樓群嗤,卻偏偏與公主長得像菠隆,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子狂秘,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 45,044評論 2 355