application(_:didFailToRegisterForRemoteNotificationsWithError:)
Tells the delegate when Apple Push Notification service cannot successfully complete the registration process.
Declaration
optional func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: any Error)Parameters
- application:
The app object that initiated the remote-notification registration process.
- error:
An Nserror object that encapsulates information why registration did not succeed. The app can choose to display this information to the user.
Discussion
UIKit calls this method if it was unable to register your app with APNs or if your app is not properly configured for remote notifications. During development, make sure your app has the proper entitlements and that its App ID is configured to support push notifications. You might use your implementation of this method to make a note of the failed registration so that you can try again later.
For more information about how to set up and send remote notifications in your app, see Setting up a remote notification server.