2017-05-02 1 views
0

J'ai fait beaucoup de recherches pendant plusieurs jours (20 posts +) mais je n'ai pas trouvé la solution à mon problème.didReceiveRemoteNotification non appelé swift 3 iOS 10

J'ai une application qui reçoivent notification push, je peux recevoir ces notifications à distance, mais quand je tape dessus, le délégué « didReceiveRemoteNotification » n'est pas appelé (je veux intercepter la charge utile de faire une action en fonction de celui-ci).

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { 
    print("test") 
} 

En avance, merci de votre aide.

La méthode didReceiveRemoteNotification ne se déclenche pas lorsque l'utilisateur lance l'application en appuyant sur la notification et non lorsque la notification est reçue, jamais.

Désolé pour mon mauvais anglais et si vous avez des questions, n'hésitez pas.

+0

double possible de [didReceiveRemoteNotification pas appelé, iOS 10] (http://stackoverflow.com/questions/39382852/didreceiveremotenotification-not-called-ios-10) –

+0

J'ai déjà essayé les solutions sur ce poste – Nuccle

+0

Si vous voulez gérer la notification quand elle est livrée à l'utilisateur? Utilisez les méthodes de protocole UNUserNotificationCenterDelegate – Mannopson

Répondre

0

Premier cadre de UserNotification d'importation, puis mettre en œuvre UNUserNotificationCenterDelegate dans ios10 pour soutenir notification push dans ios10

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping() -> Void) { 
      //Handle notification tap 
    }