iOS 11中是否已弃用无声远程推送通知?

Mer*_*tio 4 apple-push-notifications swift cksubscription unusernotificationcenter silent-notification

目前,我可以使用应用程序委托的didReceiveRemoteNotification方法接收静默推送。

该方法已被弃用,根据此方法,我们应该切换到UNUserNotificationCenterwillPresent方法,但我似乎无法使其在无声推送中起作用。既然没有任何提示可以在无声推送中显示,那么至少可以这样说是不合常理的。

已经阅读了有关推送Xcode 8的注册不带通知的CKSub以及其他很多东西,但是一切都回到了不推荐的方法。

我们是否应该使用其他方法进行静默推送(这不是面向用户的通知,但在这种情况下,它CKQuerySubscription是触发后台活动的报告)?还是应该willPresent为无声推送工作(在这种情况下,我错过了配置的一部分...)?

提前致谢。

小智 5

用这个

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler
Run Code Online (Sandbox Code Playgroud)

或Swift

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

}
Run Code Online (Sandbox Code Playgroud)

已弃用的是

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
Run Code Online (Sandbox Code Playgroud)