【发布时间】:2021-10-02 08:58:58
【问题描述】:
在应用程序活动状态下,调用didReceiveRemoteNotification方法,当应用程序处于后台和非活动状态时,不调用didReceiveRemoteNotification方法。
代码:-
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void){
NSLog("Push Received: \(userInfo)")
completionHandler(UIBackgroundFetchResult.newData)
}
【问题讨论】:
-
您期望
didReceiveRemoteNotification在后台被调用的原因是什么?
标签: ios swift push-notification apple-push-notifications