xcode 8推送通知功能和权利文件设置

人气:936 发布:2022-10-16 标签: push-notification ios10 xcode8 xcode8-beta6 unnotificationrequest

问题描述

使用xcode 8进行推送通知设置时,与xcode 7不同,xcode 8需要开发人员打开推送通知功能开关(如下图位于TARGETS -> AppName -> Capabilities),

when using xcode 8 doing the push notification setting, unlike xcode 7, xcode 8 need developer turn on push notifications capabilities switch ( located at TARGETS -> AppName -> Capabilities as following pic ),

然后它将生成如下的AppName.entitlements文件

then it will generate AppName.entitlements file as following

//AppName.entitlements
<key>aps-environment</key>
<string>development</string>

但对于生产版本的App,如果我们将字符串更改为

but for production version App, if we change the string to

//AppName.entitlements
<key>aps-environment</key>
<string>production</string>

然后功能显示警告

似乎无论在aps环境中指定哪个字符串值,我们仍然可以在application:didRegisterForRemoteNotificationsWithDeviceToken:

and it seems no matter which string value specified in aps-environment, we can still get the push device token at application:didRegisterForRemoteNotificationsWithDeviceToken:

那么推送通知权利的正确设置是什么? 谢谢

so what is the correct setting of the push notification entitlements? thank you

推荐答案

我今天在Xcode 8 GM中正为此苦苦挣扎.禁用设置,删除我的开发人员门户配置概要文件并重新生成它并再次启用设置后,我能够消除Xcode中的警告.请记住,我没有摆弄授权文件.我将其留在开发环境中,并在存档后获得了正确的aps环境设置(生产).

I was struggling with that today in Xcode 8 GM. After disabling the setting, deleting my developer portal provisioning profile and regenerating it and enabling the setting again, I was able to eliminate the warning in Xcode. Keep in mind that I didn't fiddle with the entitlements file. I left it at development environment and after archiving I got the correct aps-environment setting (production).

即使在GM中,Xcode似乎仍然非常笨拙

Seems Xcode is stilly very buggy tho even in GM

714