2017-05-02 96 views
0

我在很多天(20帖子+)做了很多搜索,但我没有解决我的问题。didReceiveRemoteNotification不叫SWIFT 3 iOS 10

我有收到推送通知,我可以接收这些远程通知,但当我敲打,委托“didReceiveRemoteNotification”不叫(我想拦截的有效载荷在它fonction做动作的应用)。

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

在此之前,感谢您的帮助。

当用户通过点击通知而不是在收到通知时启动应用程序时,didReceiveRemoteNotification方法不会触发,从不。

对不起,我的英语不好,如果你有问题,请不要犹豫。

+0

的可能的复制[didReceiveRemoteNotification不叫,iOS的10](http://stackoverflow.com/questions/39382852/didreceiveremotenotification-not-called-ios-10) –

+0

我已经试过这个帖子上的解决方案 – Nuccle

+0

如果你想处理通知,当它交付给用户?使用UNUserNotificationCenterDelegate协议方法 – Mannopson

回答

0

首次进口UserNotification框架,然后实现UNUserNotificationCenterDelegate在ios10支持推送通知在ios10

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