I've got a code that was making a successful registration for remote messages a few weeks ago. Here's how it was looking like:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
registerForRemoteNotifications(application: application)
return true
}
func registerForRemoteNotifications(application: UIApplication) {
UNUserNotificationCenter.current().delegate = self
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions,
completionHandler: { _, _ in }
)
application.registerForRemoteNotifications()
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
print(deviceToken)
}
A few weeks ago the didRegisterForRemoteNotificationsWithDeviceToken
method was calling after registration, but now neither didRegisterForRemoteNotificationsWithDeviceToken
or didFailToRegisterForRemoteNotification
methods are called. Why could this happen?