简体   繁体   English

Firebase Remote Config 在 React Native 中不起作用

[英]Firebase Remote Config does not work in React Native

No matter what I try, it seems like it is not possible to fetch values from the console with firebase remote config.无论我尝试什么,似乎都无法使用 firebase 远程配置从控制台获取值。

I am, "connected" but no values are being fetched besides the default values I have set.我是“已连接”,但除了我设置的默认值外,没有获取任何值。

I am using react-native-firebase (v6) https://rnfirebase.io/remote-config/usage我正在使用 react-native-firebase (v6) https://rnfirebase.io/remote-config/usage

//Package JSON
"react-native": "0.66.0",
"@react-native-firebase/app": "^14.11.1",
"@react-native-firebase/remote-config": "^14.11.1",

Here is my code which is executed on app load:这是我在应用程序加载时执行的代码:

  async componentDidMount() {
    const appVersion = DeviceInfo.getVersion();

    await remoteConfig().setConfigSettings({
      minimumFetchIntervalMillis: 30000,
    });

    await remoteConfig()
      .setDefaults({
        is_application_on: true,
        min_app_version: appVersion
      })
      .then(() => remoteConfig().fetchAndActivate())
      .then((fetchedRemotely) => {});

      let isAppOn = remoteConfig().getBoolean('is_application_on');
      let appMinVersion = remoteConfig().getNumber('min_app_version');

      this.setState({
        isAppOn: isAppOn ? true : false
      }, () => {
        alert(this.state.isAppOn)
        alert(appMinVersion)
      })
}

My firebase is connected but remote config is the only module I cannot seem to connect to...我的 firebase 已连接,但远程配置是我似乎无法连接的唯一模块...

Cheers.干杯。

I was able to fix it.我能够修复它。

Make sure that you're pointing to the correct google plist file.确保您指向正确的 google plist 文件。

In my case it was pointing to the wrong one in xcode, my buildphase script code was off.在我的例子中,它指向错误的 xcode,我的构建阶段脚本代码已关闭。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM