【问题标题】:didReceiveRemoteNotification:fetchCompletionHandler not being called when app is in background and inactivedidReceiveRemoteNotification:当应用程序处于后台且处于非活动状态时未调用fetchCompletionHandler
【发布时间】: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


【解决方案1】:

如果它让你平静下来,我也遇到了同样的问题,我没有采取任何措施来解决这个问题,因为几个小时后,我的应用程序开始在后台收到通知。但如果没有帮助,您应该尝试使用 ARC 手动发送通知,并检查通知状态。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多