【问题标题】:iOS - Refresh data (make Api request) on Push notification in backgroundiOS - 在后台推送通知上刷新数据(发出 Api 请求)
【发布时间】:2020-02-26 16:18:48
【问题描述】:

我正在使用后台刷新方法,在应用程序处于活动状态时工作。但是在后台模式下(应用程序没有被杀死),无法发出 Api 请求从服务器获取新数据。

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> ()) { 
        case .active:
        // works
        ...
                    completionHandler(.newData)
        case .background:

        // doesn't refresh / make api request


        completionHandler(.newData)
    }

在后台模式功能上也启用了远程通知。 在后台模式下刷新/获取数据的任何解决方案?

【问题讨论】:

  • 您是否也尝试启用Background fetch 后台模式?
  • 是的,但在我的情况下不起作用

标签: ios swift push-notification firebase-cloud-messaging


【解决方案1】:

也许下面的question,这个问题的答案可以帮助你,因为它是一个类似的问题,甚至可能是重复的。

【讨论】:

  • 感谢您的重播,但这不是我的情况
猜你喜欢
  • 2015-08-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多