ios - delay in didRegisterForRemoteNotificationsWithDeviceToken -


for reason in ios app there delay of few minutes between registerforremotenotifications , didregisterforremotenotificationswithdevicetoken

sometimes as 5 minutes ideas why be?

extension appdelegate: unusernotificationcenterdelegate { func requestpushnotification() {     if #available(ios 10.0, *) {         unusernotificationcenter.currentnotificationcenter().delegate = self         unusernotificationcenter.currentnotificationcenter().requestauthorizationwithoptions([unauthorizationoptions.alert, unauthorizationoptions.sound, unauthorizationoptions.badge]) { (success, error) in             if success {                 //uiapplication.sharedapplication().registerforremotenotifications()                 let settings = uiusernotificationsettings(fortypes: [.alert, .badge, .sound], categories: nil)                 uiapplication.sharedapplication().registerusernotificationsettings(settings)             } else {                 if error != nil {                     crashlytics.sharedinstance().recorderror(error!)                 }             }         }     } else {         let settings = uiusernotificationsettings(fortypes: [.alert, .badge, .sound], categories: nil)         uiapplication.sharedapplication().registerusernotificationsettings(settings)         //uiapplication.sharedapplication().registerforremotenotifications()     } }  @available(ios 10.0, *) func usernotificationcenter(center: unusernotificationcenter, willpresentnotification notification: unnotification, withcompletionhandler completionhandler: (unnotificationpresentationoptions) -> void) {     print("willpresentnotification") }  @available(ios 10.0, *) func usernotificationcenter(center: unusernotificationcenter, didreceivenotificationresponse response: unnotificationresponse, withcompletionhandler completionhandler: () -> void) {     print("didreceivenotificationresponse") }  func application(application: uiapplication, didregisterusernotificationsettings notificationsettings: uiusernotificationsettings) {     if notificationsettings.types != uiusernotificationtype() {         application.registerforremotenotifications()     } }  func application(application: uiapplication, didfailtoregisterforremotenotificationswitherror error: nserror) {     crashlytics.sharedinstance().recorderror(error)     print(error) } } 

and

func application(application: uiapplication, didregisterforremotenotificationswithdevicetoken devicetoken: nsdata) { } 

any ideas appreciated


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -