In app , i am trying to implement push notification , supports iOS 7 in xcode 7.3 .
after couple of running , now the didRegisterForRemoteNotificationsWithDeviceToken is not called , this is a very strange issue , the device that im running has iOS 9.3.2
here is my functions in appdelegate
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
// self.registerForPushNotificationSystem(application)
// let settings = UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: nil)
// UIApplication.sharedApplication().registerUserNotificationSettings(settings)
let notificationTypes: UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound]
let pushNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
application.registerUserNotificationSettings(pushNotificationSettings)
application.registerForRemoteNotifications()
return true
}
func application(application: UIApplication, didRegisterUserNotificationSettings notificationSettings: UIUserNotificationSettings) {
if notificationSettings.types != .None {
application.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("Device Token:", tokenString)
WebClient.sharedInstace.resgisterNotification(tokenString)
}
what might be the issue this was perfectly working fine yesterday