【发布时间】: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