我正在开发一款带有苹果推送通知集成的iPhone应用程序,对此我有一些疑问。
如果用户在APNS注册提醒中点击“不允许”按钮,我们的代码仍然会从APNS接收到设备令牌吗?
我已经测试过,当用户关闭iPhone通知时,应用程序仍然可以从APNS接收到设备令牌。这是正确的吗?
请问有人能够澄清这些疑问吗?
我正在开发一款带有苹果推送通知集成的iPhone应用程序,对此我有一些疑问。
如果用户在APNS注册提醒中点击“不允许”按钮,我们的代码仍然会从APNS接收到设备令牌吗?
我已经测试过,当用户关闭iPhone通知时,应用程序仍然可以从APNS接收到设备令牌。这是正确的吗?
请问有人能够澄清这些疑问吗?
In my understanding on APNS, it doesn't depend on the user's action (as you mentioned that if when the user clicks on "Don't Allow" button) for your iOS to receive the Device Token.
If you included in your app:
- (void)application:didRegisterForRemoteNotificationsWithDeviceToken
This means that your iOS-based app is sending a request for Push Notification registration. In return, Apple sends the Device Token to the iOS; then the iOS sends the token to the app and then the app sends it to their service provider.
Note that when the user is asked "Don't Allow" doesn't mean that you're not going to receive the device token. "Don't Allow" refers to the action to be taken to any notification received by the app that is intended for the user. Say, location. This is a whole different thing. This means that the user doesn't allow the app to use his/her location.
Yes. it still receives the Device Token as what I have discussed in my answer to your question in #1. This is only a setting for your app, which means that you won't be receiving any visible notification (badge, message or a sound) whenever there are updates about any information in relevance to your application. It's like setting your Facebook account to only receive notifications when your friends sends you a private message. Other than that, you won't be notified at all.
The process of enabling APNS is:
如果想更好地了解APNS,请查看这个链接。
我已经测试过Xcode 6.1和iOS8.1.2。目前只有两种情况下会生成设备令牌:
如果第一次拒绝苹果的同意,将不会生成设备令牌,直到在设置页面中手动更改该值。
didRegisterForRemoteNotificationsWithDeviceToken
,我得到了设备令牌。之后,我杀死了应用程序并重新启动,仍然获得了设备令牌。因此,根据示例应用程序,即使用户选择了“不允许”,我们仍将获得设备令牌。正如Kimpoy所提到的,“不允许”是指针对用户的任何通知接收到的操作。感谢Kimpoy的解释。 - iOSAppDev