Swift 远程配置 : fetchAndActivate does not update local config

标签 swift firebase-remote-config

我正在使用 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
    }
}

最佳答案

运行 pod update至少到 Firebase 6.25.0。

它修复了 race condition bug其中minimumFetchInterval在获取之前可能尚未应用。

关于Swift 远程配置 : fetchAndActivate does not update local config,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61835105/

相关文章:

exception - FirebaseRemoteConfigFetchThrottledException ? #AskFirebase

android - 是否有 API 可以*更改* Firebase 远程配置值?

ios - 删除动画后保留动画 UIView 属性,但不使用类变量?

ios - 如何在处理通知时禁止 OneSignal 打开 WebView

ios - MP3 文件无法在按钮选择上播放

firebase - "User in Random Percentile"如何在 Firebase 中工作

Firebase 远程配置, "AND condition",用户处于随机百分位数

ios - 如何在 AppDelegate.swift 中使用 Firebase Remote Config?

ios - 如何在选择时展开 UICollectionView 单元格而不弄乱 Collection View

ios - swift spritekit中解析Nodes位置时出现 fatal error