我想创建一个 Firebase A/B 测试实验并在启动它之前调整设置,方法是使用通过其 Firebase 实例 ID 添加测试设备的选项,但是,我似乎从未获得实验的远程配置参数。
获取在AppDelegate的applicationDidFinishLaunching中触发:
let remoteConfig = RemoteConfig.remoteConfig()
#if DEBUG
let expirationDuration: TimeInterval = 0
remoteConfig.configSettings = RemoteConfigSettings(developerModeEnabled: true)
#else
let expirationDuration: TimeInterval = 3600
#endif
remoteConfig.fetch(withExpirationDuration: expirationDuration) { status, error in
if let error = error {
RLogError("FirebaseHelper >>> Error fetching config: \(error)")
}
RLogInfo("FirebaseHelper >>> Config fetch completed with status: \(status)")
self.activateRemoteConfig()
}
在回调中激活远程配置后,参数永远不会存在。但是,如果我开始实验,值就会出现。无论应用程序是多次重新启动,还是我卸载并重新安装应用程序并将实例 ID 重新添加到 Draft Experiment。
任何帮助表示赞赏。