升級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
打包或用Organizer
Export導(dǎo)出App store包。
二:apiKey
和apiIssuer
需要去開發(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)建版本