DidFailToRegisterForRemoteNotificationsWithError: user refused an error?

If the user refuses push notifications, we get an error message through makeFailToRegisterForRemoteNotificationsWithError. Does anyone know what the code in the NSError object will be in this case (to distinguish it from, say, no connection available)?

+11
push ios
Feb 08 '12 at 19:18
source share
3 answers

I do not think your source statement is (always) true. If the application is correctly signed with a valid provisioning profile, a call to registerForRemoteNotificationTypes: will result in application:didRegisterForRemoteNotificationsWithDeviceToken: regardless of the choice of user notifications in the Settings application. In my experience, the only time I met application:didFailToRegisterForRemoteNotificationsWithError: was called due to an incorrectly signed application. The error cited says "there is no valid aps-environment access found for the application."

+19
Apr 03 2018-12-12T00:
source share

Although this question is old and agrees with most of @Jerred's answers, I still thought about posting an updated answer.

The answer to the main question in the stream: NO .

application: didFailToRegisterForRemoteNotificationsWithError: raised when an application signs with the wrong provisioning profile.

Besides,

application: didRegisterForRemoteNotificationsWithDeviceToken: called only when the user turns on at least one of the icons, banner / warning or sound in the notification center (in the Settings application) for your application.

There are scenarios in which iOS will not call any of these methods

  • When a user refuses to grant permissions for the application to send push notifications
  • If there is no network connection and permissions for sending push notifications are granted.
  • When a user disables push notifications for an application from the notification center in the Settings application.
+18
Apr 18 '14 at 21:34
source share

In my experience, the didFailToRegisterForRemoteNotificationsWithError: method didFailToRegisterForRemoteNotificationsWithError: reserved for more serious cases, which prevents the application from even displaying a dialog to request permission to notify the user. Cases that I know of include an application running on devices that do not support push notifications (e.g., Simulator) or some incorrect configuration in the aps-environment resolution in a binary application.

+1
Jan 15 '15 at 12:26
source share



All Articles