In qualche modo non riesco a ricevere il token del dispositivo durante la registrazione per le notifiche remote. Ricevo il modale che dice "Vuoi consentire a App X di essere in grado di inviarti notifiche", ma quando lo accetto, la funzione didRegisterForRemoteNotifications non viene chiamata.Token del dispositivo non ricevuto durante la registrazione per le notifiche remote in Swift
Quando la registrazione a notifiche remote in iOS 8/Swift utilizzando questo codice:
UIApplication.sharedApplication().registerForRemoteNotifications()
let settings = UIUserNotificationSettings(forTypes: UIUserNotificationType.Badge | UIUserNotificationType.Alert | UIUserNotificationType.Sound, categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(settings)
UIApplication.sharedApplication().registerForRemoteNotifications()
Queste funzioni non vengono attivate affatto:
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData!)
e
func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError!)
tuttavia quando registro questo
println("current settings \(UIApplication.sharedApplication().currentUserNotificationSettings()) and \(UIApplication.sharedApplication().isRegisteredForRemoteNotifications())")
ricevo
"current settings <UIUserNotificationSettings: 0x170437120; types: (UIUserNotificationTypeAlert UIUserNotificationTypeBadge UIUserNotificationTypeSound);> and true"
mio profilo di provisioning e certificati ar tutto in ordine.
Qualcun altro ha avuto questo problema?
Perché si chiama 'registerForRemoteNotifications()' due volte? – ricardopereira
1) creare notifica push e allegare con il proprio profilo 2) on in funzionalità push notification 3) Invia token dispositivo vedere di più in basso la mia risposta è lì –