简体   繁体   English

Apple推送通知注册和设备令牌是否收到澄清?

[英]Apple Push Notification Registration & Device Token Receive clarification?

I am working on an iPhone app with Apple Push Notification integration. 我正在使用Apple Push Notification集成的iPhone应用程序。 I have some doubts on this. 我对此有些怀疑。

  1. If the user clicked "Dont Allow" button in the APNS registration alert, will our code still receives the Device Token from APNS? 如果用户点击了APNS注册提醒中的“不允许”按钮,我们的代码是否仍会从APNS收到设备令牌?

  2. I have tested that when the user switched off the notification in iPhone notification, still the app receives the Device Token from APNS? 我已经测试过,当用户在iPhone通知中关闭通知时,应用程序仍会从APNS接收设备令牌吗? It is correct? 它是正确的?

Can anyone please clarify these doubts? 任何人都可以澄清这些疑虑吗?

  1. 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. 根据我对APNS的理解,它不依赖于用户的操作(正如您提到的那样,如果用户点击“不允许”按钮),您的iOS就会收到设备令牌。

    If you included in your app: 如果您包含在您的应用中:

     - (void)application:didRegisterForRemoteNotificationsWithDeviceToken 

    This means that your iOS-based app is sending a request for Push Notification registration. 这意味着您的基于iOS的应用程序正在发送推送通知注册请求。 In return, Apple sends the Device Token to the iOS; 作为回报,Apple将设备令牌发送到iOS; then the iOS sends the token to the app and then the app sends it to their service provider. 然后iOS将令牌发送到应用程序,然后应用程序将其发送给他们的服务提供商。

    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. 这意味着用户不允许该应用使用他/她的位置。

  2. Yes. 是。 it still receives the Device Token as what I have discussed in my answer to your question in #1. 它仍然收到设备令牌,正如我在#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. 这就像将您的Facebook帐户设置为仅在您的朋友向您发送私人消息时接收通知。 Other than that, you won't be notified at all. 除此之外,您将不会得到任何通知。

    The process of enabling APNS is: 启用APNS的过程是:

    1. Request for certificate Authority 申请证书授权
    2. Create app id 创建应用ID
    3. Configuring AppId for Push Notifications 为推送通知配置AppId
    4. Create provisioning profile 创建配置文件
    5. Provisioning a device 配置设备
    6. Enabling the profile in Xcode 在Xcode中启用配置文件
    7. Creating push notification provider. 创建推送通知提供程序

For more understanding on APNS, check this out. 有关APNS的更多信息,请查看此信息

I have tested with Xcode 6.1, ios8.1.2. 我已经使用Xcode 6.1,ios8.1.2进行了测试。 Currently the device token will be generated only in two cases 目前,设备令牌仅在两种情况下生成

  1. Apple's default consent with "Ok" option Apple的默认同意为“Ok”选项
  2. After "Dont allow", manual change in Setting->Notifications->app->AllowNotification(On) 在“不允许”之后,在设置 - >通知 - > app-> AllowNotification(On)中手动更改

By declining first time with apple's consent, will not generate device token, till manually change the value in settings page. 通过苹果同意第一次拒绝,不会生成设备令牌,直到手动更改设置页面中的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM