ios - 远程配置 A/B 测试不会在测试设备上触发(或 100% 匹配)

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

所以我现在已经设置了几次 A/B 测试实验,无论它是否处于“草稿”阶段(我使用 InstanceID.instanceID().token( )) 或在一个完全启动和运行的实验中(我为 100% 的用户设置匹配我的应用程序包 ID),当我这样做时,我没有看到我的测试变体中的参数到达远程配置:

func loadRemoteConfig()
{
    let remoteConfig = RemoteConfig.remoteConfig()
    let remoteConfigSettings = RemoteConfigSettings(developerModeEnabled: true)
    remoteConfig.configSettings = remoteConfigSettings!

    remoteConfig.setDefaults(fromPlist: "RemoteConfigDefaults")

    remoteConfig.fetch(withExpirationDuration: TimeInterval(1)) { (status, error) in

        if let actualError = error
        {
            DDLogError("error from loadRemoteConfig is \(actualError.localizedDescription)")
        } else {
            switch(status)
            {
            case RemoteConfigFetchStatus.noFetchYet, RemoteConfigFetchStatus.failure, RemoteConfigFetchStatus.throttled :
                DDLogDebug("loadRemoteConfig got a \(status) status")
            case RemoteConfigFetchStatus.success :
                break
            }

            remoteConfig.activateFetched()

            // my A/B test parameter doesn't arrive in this array, ever.
            let arrayOfKeys = remoteConfig.allKeys(from: RemoteConfigSource.remote, namespace: NamespaceGoogleMobilePlatform)
            print("array of keys is \(arrayOfKeys.count) & \(arrayOfKeys)")

            // do some stuff here, depending on what Firebase tells us to do...
        }
    }

    self.remoteConfig = remoteConfig
}

此代码存在于初始 View Controller 中,而不是应用程序委托(delegate)中。

这是我的 Firebase A/B 页面的样子,我只想在其中显示演示的工具提示:

Firebase Experiment Page

如何让 A/B 测试和实验参数与 RemoteConfig 提取一起出现?

最佳答案

好的!这是我自己解决的问题之一。

发生的事情的关键在于我问题的这句话:

This code lives in the initial view controller and not the app delegate.

发生的事情是 applicationDidFinishLaunching: 不一定完成(或者,更具体地说,remoteConfig.fetch 的结果或完成 block 在applicationDidFinishLaunching 结束)。

因此,在 remoteConfig 从 Firebase 检索更新之前,我在初始 View Controller 的 viewDidLoad 函数中检查远程配置值。

根据 remoteConfig.fetch 的结果向新注册的观察者发送通知,使我能够显示我的 A/B 测试参数。

关于ios - 远程配置 A/B 测试不会在测试设备上触发(或 100% 匹配),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49060002/

相关文章:

ios - 我对 NSUserDefaults 中的 NSMutableArray 结构做错了什么? "attempt to insert non-property list object"

ios - 将推送通知证书导出为 P12

android - 如何检测用户是否第一次使用 Firebase

java - Firebase - 将子项添加到数组列表 - java

firebase - 为什么 functions.config() 返回 {}?

python - Python 中的 A/B 拆分测试有哪些资源?

asp.net-mvc - 在 asp.net mvc 中实现 A-B 测试的最佳/最干净的方法是什么?

ios - Linux ARM ELF 和 iOS ARM ELF 文件有什么区别?

ios - Soundcloud Player 在 Mobile/iOS 上锁定

html - 拆分A/B测试