3

I have an app installed on an IOS 10 device that cannot seem to get the notification token. When the device was still on IOS 9, this was not a problem and when I try using the same app version on an iOS 9 device, the notification token is able to be sent over to the server. What could the issue be that is specifically not showing the notification token on IOS 10?

My code in AppDelegate:

 func application(application: UIApplication, didRegisterUserNotificationSettings notificationSettings: UIUserNotificationSettings)
    {
        UIApplication.sharedApplication().registerForRemoteNotifications()
    }
     func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
            let tokenChars = UnsafePointer<CChar>(deviceToken.bytes)
            var tokenString = ""
            for i in 0..<deviceToken.length {
                tokenString += String(format: "%02.2hhx", arguments: [tokenChars[i]])
            }
            print("tokenString: \(tokenString)")
            NSUserDefaults.standardUserDefaults().setObject(tokenString, forKey: "NToken")
        }

I am not sure what the issue is, but on IOS 9 everything was fine; the notification token could be retrieved and sending notifications work.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Matt
  • 1,087
  • 1
  • 12
  • 28
  • You need to implement UserNotification framework to support push notification in iOS 10. https://developer.apple.com/reference/usernotifications – Ashish Shah Sep 15 '16 at 14:14
  • You can see this as a reference: http://stackoverflow.com/questions/39490605/push-notification-issue-with-ios-10?answertab=votes#tab-top – Ashish Shah Sep 15 '16 at 14:27

0 Answers0