Firebase 远程配置 A/B 测试草案未在 iOS 上提供值

Firebase Remote Config A/B Test draft does not provide values on iOS

我已经在 Firebase 上创建了一个 AB 测试(尚未发布)并添加了测试设备的令牌。 但是所提供的键没有值。

由于 AB 测试处于 Beta 阶段,因此它在测试设备上不起作用是 Firebase 方面的错误吗?

let remoteConfig = RemoteConfig.remoteConfig()
remoteConfig.fetch(withExpirationDuration: 0) { status, _ in
        if status == RemoteConfigFetchStatus.success {
            remoteConfig.activateFetched()
            let ab_test_value = remoteConfig.configValue(forKey: "ab_test_key").stringValue
            print(ab_test_value)
 }}

ab_test_value 是空的。

尝试这可能会在响应到来时释放您的变量

var remoteConfig:FIRRemoteConfig?

///

var expirationDuration = 43200;
// If in developer mode cacheExpiration is set to 0 so each fetch will retrieve values from
// the server.
if (remoteConfig?.configSettings.isDeveloperModeEnabled)!
{
     expirationDuration = 0;
}


self.remoteConfig?.fetch(withExpirationDuration: TimeInterval(expirationDuration))
{
    (status, error) -> Void in
    if status == .success
    {
        print("Config fetched!")
         self.remoteConfig?.activateFetched()
    }
    else
    {
        print("Config not fetched")
        print("Error \(error!.localizedDescription)")

       // return
    }

    self.displayWelcome()

    }

}