应公司需要,最近在学习iOS开发,boss安排我去发布2个新的版本。还是新手的我,在这几天被折腾的不要不要的,不过最终还是成功了。期间碰到了许多坑,都一一填上了。为了印象更深刻些,就把其中几个记下来。
重要的事说三遍: iOS开发和发布是两套流程!两套 !套!
1. 配置
在苹果开发者账户中,打开Certificates, Indentifiers & Profiles能看到如下图样:
开发者可以在这里面配置各种需求。还是得注意配置两套,开发和发布。
ps: 得搞明白:iOS Certificates、iOS App IDs、Devices和iOS Provisioning Profiles之间的关系。
在xcode下需要对开发和发布进行不同的配置。其中就包括配置开发证书和发布证书(Certificates)。还有开发和发布的pp文件(Provisioning Profiles)。这在xcode里面需要在build settings里面的debug和release选项中分别配置。
我开始就是因为初学iOS开发,不知道怎么配置开发和发布证书,导致出现了很多错误,项目一运行就出现N多错误。配置好了就万事OK。其中需要注意的是,调试的时候不要运行配置了发布配置文件(pp)的release版本,否则会导致xcode报错,运行不起来。或者是项目安装上了,但是启动就报错crash掉。
2. 关于推送服务。
xcode的推送服务需要自己打开。在TARGETS下的Capabilities中,找到Push Notifications,打开开关即可。
xcode8.2.1中,打开开关后,如果一切正常,是这样的:
xcode 7.3.1中,是这样的:
我在打包IPA上传至App Store时出现了这么个情况:打包一切通过,上传完毕,苹果验证通过。但是一会后发给我一封邮件:
//
Dear developer,
We have discovered one or more issues with your recent delivery for "我的应用". Your delivery was successful, but you may wish to correct the following issues in your next delivery:
Missing Push Notification Entitlement - Your app appears to register with the Apple Push Notification service, but the app signature's entitlements do not include the "aps-environment" entitlement. If your app uses the Apple Push Notification service, make sure your App ID is enabled for Push Notification in the Provisioning Portal, and resubmit after signing your app with a Distribution provisioning profile that includes the "aps-environment" entitlement. Xcode 8 does not automatically copy the aps-environment entitlement from provisioning profiles at build time. This behavior is intentional. To use this entitlement, either enable Push Notifications in the project editor's Capabilities pane, or manually add the entitlement to your entitlements file. For more information, see https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/HandlingRemoteNotifications.html#//apple_ref/doc/uid/TP40008194-CH6-SW1.
After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to iTunes Connect.
Regards,
The App Store team
//
大概意思是说我的应用虽然通过初步验证,能进入正式审核阶段,但是我的推送服务设置出错,应用无法使用推送服务。
我当时很懵逼。我检查所有设置:开发者中心,app IDS,正确;pp文件,正确;xcode设置,推送打开了。很无语。网上查询了半天,大多是说app IDS的推送证书没有加上,但是我的已经加上了的。pp文件也是正确设置了的。最后没办法,重新下载pp文件,删除原先的,重新配置,打包上传,尽然成功了?
ps:根据网上的消息,推送服务成功继承的标志是,版本信息中的权限有:aps-environment: production。
3. 上传app到App Store卡在App Store检查项上面
很大可能是网络原因,找个靠谱的翻墙工具吧!
4. iTunes Connect上面显示在销售状态,但是App Store还是原来的版本
苹果再次背锅。按照网上的说法,解决方法是:先修改app 发售地区、价格,之后再改回去。过大概半小时到2小时就能在App Store上看到新版本了。