且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iOS 10 静默推送通知不会触发后台应用程序

更新时间:2022-12-21 10:58:58

方法

func userNotificationCenter(center: UNUserNotificationCenter, didReceiveNotificationResponse response: UNNotificationResponse, withCompletionHandler completionHandler: () -> Void) {
    // Handle notification
}

当用户点击通知或在 Apple Watch 上查看通知时调用:

called when user taps on notification or check it on Apple Watch:

调用以让您的应用知道用户为给定通知选择了哪个操作.

Called to let your app know which action was selected by the user for a given notification.

你需要实现旧的方法

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

}