didFailToRegisterForRemoteNotificationsWithError: user refused error?

前端 未结 4 2029
梦谈多话
梦谈多话 2021-02-04 07:22

If the user refuses the enable push notifications, we\'ll get an error, through didFailToRegisterForRemoteNotificationsWithError. Does anybody know what the code in the NSError

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-04 08:04

    Although this question is old, and agree with most of the @Jerred's answer, i thought of posting an updated answer anyway.

    The answer to main question in the thread is NO.

    application:didFailToRegisterForRemoteNotificationsWithError: gets called when the app is signed with incorrect provisioning profile.

    Also,

    application:didRegisterForRemoteNotificationsWithDeviceToken: gets called only when user enables at-least one of the badge, banner/alert or sound setting in the notification center (in Settings app) for your app.

    There are scenarios where iOS will not call either of these methods

    • When user refuses to grant permissions for app to send push notifications
    • When there is no network connectivity and user granted permissions to send push notifications.
    • When user disables the push notifications for app from notification center in Settings app.

提交回复
热议问题