xcode 8 推送通知功能和权利文件设置 [英] xcode 8 push notification capabilities and entitlements file setting

查看:74
本文介绍了xcode 8 推送通知功能和权利文件设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用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-environment 中指定了哪个字符串值,我们仍然可以在 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-environment 设置(生产).

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

这篇关于xcode 8 推送通知功能和权利文件设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆