【发布时间】:2020-05-16 10:09:19
【问题描述】:
我正在使用 Swift 在 iOS 上开始使用 RemoteConfig,并按照教程开始使用。我启用了开发人员模式并通过 Firebase 控制台测试了配置值的更新。但是,更新值永远不会与本地配置值同步。
代码:
override func viewDidLoad() {
super.viewDidLoad()
syncRemoteConfig()
}
fileprivate func syncRemoteConfig() {
let remoteConfig = RemoteConfig.remoteConfig()
#if DEBUG
let settings = RemoteConfigSettings()
settings.minimumFetchInterval = 0
remoteConfig.configSettings = settings
#endif
remoteConfig.fetchAndActivate { (status, error) in
let posts = remoteConfig.configValue(forKey: "posts").jsonValue as! [[String: AnyObject]]
print(posts) // <== Always print the previous data
if let error = error {
print(error.localizedDescription)
}
//status always prints status.successUsingPreFetchedData
}
}
【问题讨论】:
标签: swift firebase-remote-config