【问题标题】:Remote Config A/B Test does not provide results on iOS远程配置 A/B 测试在 iOS 上不提供结果
【发布时间】:2017-11-17 10:46:17
【问题描述】:

两天前,我在我的 iOS 应用上使用以下代码在 Firebase Remote Config 上创建并启动了 A/B 测试:

[FIRApp configure];
[FIRRemoteConfig.remoteConfig fetchWithCompletionHandler:^(FIRRemoteConfigFetchStatus status, NSError * _Nullable error) {
        // Do nothing
    }];
[FIRRemoteConfig.remoteConfig activateFetched];

我已确认测试正在进行,因为在某些设备上我可以看到测试正在进行。

问题是,两天后,Firebase 控制台一直说有 0 个用户参与了实验。另一方面,我使用相同的代码在 Android 上进行了另一次测试,几个小时后我可以看到活动。

我有什么遗漏吗?

编辑 - Pod 版本:

Using Firebase (4.5.0)
Using FirebaseABTesting (1.0.0)
Using FirebaseAnalytics (4.0.4)
Using FirebaseCore (4.0.10)
Using FirebaseInstanceID (2.0.5)
Using FirebasePerformance (1.0.6)
Using FirebaseRemoteConfig (2.1.0)

【问题讨论】:

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


    【解决方案1】:

    问题是您在 fetch 方法之外调用了activateFetched()。 您应该在完成处理程序成功返回时调用它:

    [FIRRemoteConfig.remoteConfig fetchWithExpirationDuration:expirationDuration completionHandler:^(FIRRemoteConfigFetchStatus status, NSError *error) {
        if (status == FIRRemoteConfigFetchStatusSuccess) {
            [FIRRemoteConfig.remoteConfig activateFetched];
        } else {
            // Manage error case
        }
    }];
    

    【讨论】:

      【解决方案2】:

      嗯...老实说,看起来你在这里做所有事情。

      请注意,您设置远程配置获取的方式需要两个会话才能使更改生效(您基本上遵循this blog post 中描述的“下次加载值”方法)所以可能两天是获取任何数据所需的最低限度,这取决于人们使用您的应用程序的频率。也许再等一两天,看看发生了什么。

      另外,显然,这不言而喻,但如果您刚刚发布了包含更新的库和所有内容的新版本应用程序,您可能还需要等待一段时间让所有用户更新到最新版本您的应用,

      【讨论】:

        【解决方案3】:

        最后我重现了这个问题并找到了解决方法。

        关键是将activateFetchedapplication:didFinishLaunchingWithOptions:方法中分离出来。

        所以,这是解决方法(使用 Firebase 4.7.0 测试):

        [FIRApp configure];
        [FIRRemoteConfig.remoteConfig fetchWithExpirationDuration:60*60 completionHandler:^(FIRRemoteConfigFetchStatus status, NSError * _Nullable error) {
            // Do nothing
        }];
        
        dispatch_async(dispatch_get_main_queue(), ^{
            [FIRRemoteConfig.remoteConfig activateFetched];
        });
        

        【讨论】:

        • 这种方法创建了一个竞争条件,您假设 fetchWithExpirationDuration 在您的 dispatch_async 运行之前完成。相反,请使用fetchAndActivate
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-08-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多