首页 文章

didReceiveRemoteNotification不叫swift 3 iOS 10

提问于
浏览
1

我在很多天里做了很多搜索(20个帖子),但我没有解决我的问题 .

我有一个接收推送通知的应用程序, I can receive those remote notifications but 当我点击它时,代理"didReceiveRemoteNotification"没有被调用(我想拦截有效负载以执行它的动作) .

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

提前,谢谢你的帮助 .

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

抱歉我的英语不好,如果您有疑问,请不要犹豫 .

1 回答

  • 0

    First import UserNotification framework and then implement UNUserNotificationCenterDelegate in ios10 to support push notification in ios10

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

相关问题