【问题标题】:Firebase Remote Config A/B Test draft does not provide values on iOSFirebase 远程配置 A/B 测试草稿未在 iOS 上提供值
【发布时间】:2018-02-15 11:08:42
【问题描述】:

我在 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 为空。

【问题讨论】:

    标签: ios swift firebase ab-testing firebase-remote-config


    【解决方案1】:

    试试这个可能你的变量在响应到来时被释放

    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()
    
        }
    
    }
    

    【讨论】:

    • 它仅在实验发布时有效,不适用于草稿实验
    • 可能你遗漏了一些即使在调试模式下也能对我有用的东西,请确保 ** FIRApp.configure() ** 在 didFinishLaunching 之上
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多