【发布时间】:2018-06-07 15:07:00
【问题描述】:
我在我的应用中使用 Firebase 远程配置功能。 我需要在获取请求上添加网络超时。
#if DEBUG
let expirationDuration: TimeInterval = 0
RemoteConfig.remoteConfig().configSettings = RemoteConfigSettings(developerModeEnabled: true)
#else
let expirationDuration: TimeInterval = 3600
#endif
RemoteConfig.remoteConfig().fetch(withExpirationDuration: expirationDuration) {
[weak self] (status, error) in
guard error == nil else {
print ("Uh-oh. Got an error fetching remote values \(String(describing: error))")
return
}
RemoteConfig.remoteConfig().activateFetched()
self?.fetchComplete = true
self?.loadingDoneCallback?()
}
我该怎么办?
【问题讨论】:
-
为什么需要超时?
-
@DougStevenson 由于网络非常糟糕,我的应用程序无限期加载并且永远不会返回 fetchComplete=true
-
您的应用不应等待获取结果。您应该在结果完成时异步处理结果。
-
我的参数必须在启动主屏幕之前加载。
-
我认为你必须自己实现一些东西。 Firebase API 在这里帮不了您。
标签: ios swift firebase timeout firebase-remote-config