didRegisterForRemoteNotificationsWithDeviceToken s

2019-04-20 01:00发布

问题:

I am testing my app for using Push Notifs. It worked well the whole day and suddenly it stopped. No changes in the setup at all. After debugging a bit more, I found out, that the function didRegisterForRemoteNotificationsWithDeviceToken never gets called anymore. I set a breakpoint at this function and it is not called at all when the app starts up, or I re-install the app. I get the actionsheet if I want to allow push notifs, but the delegate is never called afterwards.

    settings = UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: nil)
    UIApplication.sharedApplication().registerUserNotificationSettings(settings!)
    UIApplication.sharedApplication().registerForRemoteNotifications()