【问题标题】:react-native firebase remote configreact-native firebase 远程配置
【发布时间】:2018-10-31 10:09:48
【问题描述】:
if (__DEV__) {
        firebase.config().enableDeveloperMode();
    }


    firebase
        .config()
        .fetch()
        .then(() => firebase.config().activateFetched())
        .then(() => {
            // Chain additional firebase config methods if needed
            console.log("activated ");
            firebase
                .config()
                .getValue("holiday_promo")
                .then(data => {
                    console.log(data, "data");
                });
        })
        .catch(error => console.log(`Error processing config: ${error}`));

在我的 firebase 远程配置中,我有一个参数如下: holiday_promo(parameter_key) 和 value 是 "promo string" 。 但是当我控制台数据时,它是空的。 得到这样的东西: {source: "remote" val: ƒ val() arguments: null caller: null length: 0 name: "val" } 谁能告诉我怎么了..

【问题讨论】:

    标签: firebase react-native firebase-remote-config


    【解决方案1】:

    你必须调用函数val()来获取数据。

    firebase
    .config()
    .getValue("holiday_promo")
    .then(data => {
        console.log("data => ", data.val());
    });
    

    【讨论】:

      【解决方案2】:
      firebase
        .config()
        .fetch(0) ...
      

      远程配置默认缓存 12 小时,enableDeveloperMode 不会绕过缓存,它只是允许更频繁地刷新它。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-09-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-07-12
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多