2

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:

Push notification

Background Mode:

Background Mode

  • Just to understand the situation : you have two device on witch you test so the fist one has iOS 9 and the other has iOS 10 ? – BEN MESSAOUD Mahmoud Jan 27 '17 at 11:09
  • @BENMESSAOUDMahmoud one device have os version 9.3.5 another device os version 10.2 both are working by apn tester but .. when application publish then not working device 9.3.5 –  Jan 27 '17 at 11:16
  • @Arasuvel my did not receive push notification ios 9 .. no problem to receiving push notification ios 10 –  Jan 27 '17 at 11:21
  • @Arasuvel what is the configuration for ios9 swift2 could you tell me please –  Jan 27 '17 at 11:24
  • check this : http://stackoverflow.com/questions/39532953/push-notifications-not-being-received-on-ios-10-but-working-on-ios-9-and-before is the opposite of your situation but that's could give you some idea. Let me know ig this solve your problem. – BEN MESSAOUD Mahmoud Jan 27 '17 at 11:26
  • @BENMESSAOUDMahmoud No such module 'UserNotifications' i am working with swift 2 and xcode 7 –  Jan 27 '17 at 11:39

0 Answers0