Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firebase A/B测试在iOS上使用激活事件时不计算用户数_Ios_Firebase_Firebase Analytics_Firebase Ab Testing - Fatal编程技术网

Firebase A/B测试在iOS上使用激活事件时不计算用户数

Firebase A/B测试在iOS上使用激活事件时不计算用户数,ios,firebase,firebase-analytics,firebase-ab-testing,Ios,Firebase,Firebase Analytics,Firebase Ab Testing,我们正在使用Firebase iOS框架(5.9.0)的当前版本,在尝试运行具有激活事件的a/B测试实验时,我们发现了一个奇怪的问题 因为我们想在第一次启动时运行实验,所以在获取远程配置时,我们在应用程序启动时会显示一个自定义启动屏幕。抓取完成后,我们立即激活抓取的配置,然后检查是否收到有关参与实验的信息,以适当地重新配置下一个UI。在我们确定当前实例实际上应该是测试的一部分(因此是激活事件)之前,还需要进行额外的检查。基本上,代码如下所示: <code that shows splash

我们正在使用Firebase iOS框架(5.9.0)的当前版本,在尝试运行具有激活事件的a/B测试实验时,我们发现了一个奇怪的问题

因为我们想在第一次启动时运行实验,所以在获取远程配置时,我们在应用程序启动时会显示一个自定义启动屏幕。抓取完成后,我们立即激活抓取的配置,然后检查是否收到有关参与实验的信息,以适当地重新配置下一个UI。在我们确定当前实例实际上应该是测试的一部分(因此是激活事件)之前,还需要进行额外的检查。基本上,代码如下所示:

<code that shows splash>

…

[[FIRRemoteConfig remoteConfig] fetchWithExpirationDuration:7 completionHandler:^(FIRRemoteConfigFetchStatus status, NSError * _Nullable error) {

    [[FIRRemoteConfig remoteConfig] activateFetched];

    if (<checks that see if we received info about being selected to participate in the experiment and if local conditions are met for experiment participation>) {

        [FIRAnalytics logEventWithName:@"RegistrationEntryExperimentActivation" parameters:nil];

        <dismiss splash screen and show next UI screen based on experiment variation received in remote config>
    } else {
        <dismiss splash screen and show next UI screen>
    }
}
实验的条件用户属性事先得到正确设置,并由事件触发(导致实验激活和后续事件被正确标记为实验的一部分)

现在,这段代码显然非常难看,并且容易出现可能的竞争条件。保守地说,0.5秒的延迟在所有iOS设备上都是足够的,但是_(ツ)_/“”。我已经多次阅读了可用文档,并尝试查看所有可用的API方法,但没有成功地找出开始发送事件的正确点。如果
activateFetched
方法使用异步过程重新配置内部对象,则可能会出现一个回调方法,指示向调用者说明一切都已完成、重新配置并准备好供应用程序进一步使用的时间点。似乎框架工程师没有预料到有人需要在远程配置文件激活后立即发送激活事件的用例

还有其他人遇到过这个问题吗?我们是否缺少API中的某些内容?是否有更聪明的方法让
activateFetched
完成它的工作

希望一些Firebase工程师也能加入他们的智慧:)


谢谢

我可以确认,使用
firebase配置:16.0.0
库版本的Android上也存在同样的问题。调用
activateFetched()
时,它不会立即设置条件属性,如果在此之前发送了激活事件,则不会激活用户进行实验……感谢您提出了一个丑陋但有用的想法!我想我应该试试。。。因为这个决定总比什么都没有好
<code that shows splash>

…

[[FIRRemoteConfig remoteConfig] fetchWithExpirationDuration:7 completionHandler:^(FIRRemoteConfigFetchStatus status, NSError * _Nullable error) {

    [[FIRRemoteConfig remoteConfig] activateFetched];

    if (<checks that see if we received info about being selected to participate in the experiment and if local conditions are met for experiment participation>) {

        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

            [FIRAnalytics logEventWithName:@"RegistrationEntryExperimentActivation" parameters:nil];

            <dismiss splash screen and show next UI screen based on experiment variation received in remote config>
        }
    } else {
        <dismiss splash screen and show next UI screen>
    }
}