【问题标题】:Swift Remote Config: fetchAndActivate does not update local configSwift 远程配置:fetchAndActivate 不更新本地配置
【发布时间】: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


    【解决方案1】:

    运行 pod update 至少到 Firebase 6.25.0。

    它修复了 race condition bug 在提取之前可能未应用 minimumFetchInterval 的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-06-14
      • 1970-01-01
      • 2019-08-11
      • 2023-03-27
      • 2016-12-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多