Xcode11 Application Loader altool上传ipa

做iOS开发的,都知道发布应用到商店,需要经过代码编译、打包、签名、上传、testflight、审核等好几个步骤。

这篇文章已经对打包、签名做了详细介绍,在后续的工作中,我们使用了自己开发的工具,结合fastlane来走自动化流程。

如何你是xcode10版本或者更低,请来这里看。

这里主要讲一下,xcode升级到11版本后,如何上传ipa文件。

起因

升级xcode11后,你会发现找不到Application loader这个工具了。

看了我关于xcode10打包的文章,都知道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)

不知道是出于什么原因,不支持Application loader,后续应该了解到。

突然想到了一些原因:

Application loader中集成的低版本altool,在终端里,帮助文档有描述,是上传ipa、pkg文件的。

xcrun altool的改进

上面提到,xcrun altool 是新的上传打包文件方式之一。

终端运行,xcrun altool

刚看到帮助信息时,没仔细看,觉得和旧版本以前一样,使用开发者账号和密码就可以了。

不能再直接使用开发者账号、密码直接上传

但我运行时,遇到了一个认证问题:

xcrun altool  --list-apps -u <开发者账号> -p <密码> --output-format xml 

2019-09-26 13:01:51.896 altool[60451:1402637] *** Error: Failed to retrieve all applications:

(

    "Error Domain=ITunesSoftwareServiceErrorDomain Code=-22011 \"We are unable to create an authentication session.\" UserInfo={NSLocalizedDescription=We are unable to create an authentication session., NSLocalizedFailureReason=Unable to validate your application.}"

)

回想一下认证相关的经验,应该是双重认证导致的,需要动态验证码,我当时也考虑查看fastlane相关插件的源码,看他们是如何认证的,虽然目前实现了,但可能和fastlane的实现还有很多不足。

去查找双重认证的信息,提到了一段有用信息:

If you are signed in to iCloud for Windows, you don't need an app-specific password when using your Apple ID with third-party Microsoft apps.

To generate and use app-specific passwords, your Apple ID must be protected with two-factor authentication.

You also need an app-specific password for your devices that use Mac OS X Lion 10.7.5 and earlier or iOS 5 and earlier. If you don’t have devices that can be updated to iOS 9 or later or OS X El Capitan or later, you can set up two-step verification and generate app-specific passwords.

再去查看xcrun altool的帮助信息,多了两个参数--apiKey 、--apiIssuer,在apple的开发者网站,搜不到这两个关键词的。

又去查找上传ipa包的文档,找到一个有用的文档,有两个有用信息,

Because you can't upload the .app bundle directly to the notary service, you’ll need to create a compressed archive containing the app

省略一些demo命令

Alternatively, you can put apps, kernel extensions, and other software in a container, like a disk image, and notarize the container. The notary service accepts disk images (UDIF format), signed flat installer packages, and ZIP archives. It processes nested containers as well, like packages inside a disk image.

为何新版本的xcode11不支持ApplicationLoader

结合旧版本的altool,我有一些明白为何xcode11不支持Application Loader了,xcode11最出色的点,是支持了swfitUI,一统mac、ipad、iphone,如上面官方帮助描述一样,新版本的额altool支持了各种文件压缩包的上传,应该就是mac、ipad、iphone应用和其他相关打包产物的集合包,而旧版本的altool只支持ipa、pkg的上传。

如何使用xcrun altool验证、上传ipa包

xcrun altool有很多功能,我只结合以前的流程,验证、上传,来实现本期开发任务。

有双重认证限制后,不能直接使用账号密码了,只能使用新的-apiKey 、--apiIssuer。

仔细查看它们的介绍:

   --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我不熟悉,又去官网搜索帮助信息,最终找到了一篇介绍

简单讲就是登录iTunesConnect --->用户与访问--->密钥,至此,生成相应身份的密钥,再将私钥下载下来。

至此,你可以明白什么是apiKey、issuser了。

开始使用又把我坑了一把,这个apiKey的值,就是图中的密钥ID,我们将其对应私钥下载下来后,需要放到一个固定目录下,

'./private_keys'或者'~/private_keys' 或者'~/.private_keys' 或者'~/.appstoreconnect/private_keys'.

也怪我不仔细看介绍:

--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'.

最终的验证、上传的两个命令:

xcrun altool --validate-app -f xxx/xxx/xxx.ipa -t ios --apiKey xxxxxxxx --apiIssuer xxxxxx --verbose

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

总结

有问题,多看官方文档!

  • 3
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 17
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 17
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值