IOS remote push notification (testflight?) not working IOS9 where it is full working IOS10. What can I do?
Note: also I am testing by apn tester both IOS9 and IOS10 it is working fine. My project in swift 2.
Full code here:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
//ask for user to permited push notification
registerForPushNotifications(application)
//crate notification with sound alert, Badge , and sound
let notificationTypes: UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound]
//add nofification type in system notification
let pushNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
application.registerUserNotificationSettings(pushNotificationSettings)
//register for remot notificaiton not local
return true
}
//MARK:- Push Notification configaratin
func application(application: UIApplication, didRegisterUserNotificationSettings notificationSettings: UIUserNotificationSettings) {
if notificationSettings.types != .None{
application.registerForRemoteNotifications()
}
}
func registerForPushNotifications(application: UIApplication)
{
let notificationSettings = UIUserNotificationSettings(forTypes: [.Badge, .Sound, .Alert], categories: nil)
application.registerUserNotificationSettings(notificationSettings)
}
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
//send Device Id
}
func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError)
{
print("Failed to register:", error)
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
self.showingAlert("notification arived 3: \(userInfo)")
}
Push notification:
Background Mode: