且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iOS7 和 iOS8:如何检测用户何时拒绝推送通知请求

更新时间:2022-12-30 09:17:45

你的 didFailToRegisterForRemoteNotificationsWithError 方法没有被调用,因为注册没有失败——它甚至从未尝试过,因为用户拒绝了请求.

Your didFailToRegisterForRemoteNotificationsWithError method isn't called, because the registration didn't fail - it was never even attempted because the user denied the request.

在 iOS7 上,您可以执行以下操作:

On iOS7 you can do a couple of things:

  1. 假设在调用 didRegisterForRemoteNotificationsWithDeviceToken 之前远程通知不可用
  2. 检查 UIApplication 对象上的 enabledRemoteNotificationTypes
  1. Assume that remote notifications aren't available until didRegisterForRemoteNotificationsWithDeviceToken is called
  2. Check the value enabledRemoteNotificationTypes on the UIApplication object