react-native firebase 远程配置
react-native firebase remote config
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) 并且值为 "promo string" 。
但是当我安慰数据时,它是空的。
得到这样的东西:
{source: "remote"
val: ƒ val()
arguments: null
caller: null
length: 0
name: "val" }
谁能告诉我哪里出了问题..
您必须调用函数 val()
才能获取数据。
firebase
.config()
.getValue("holiday_promo")
.then(data => {
console.log("data => ", data.val());
});
firebase
.config()
.fetch(0) ...
远程配置默认缓存 12 小时,enableDeveloperMode 不会绕过缓存,它只是允许更频繁地刷新它。
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) 并且值为 "promo string" 。
但是当我安慰数据时,它是空的。
得到这样的东西:
{source: "remote"
val: ƒ val()
arguments: null
caller: null
length: 0
name: "val" }
谁能告诉我哪里出了问题..
您必须调用函数 val()
才能获取数据。
firebase
.config()
.getValue("holiday_promo")
.then(data => {
console.log("data => ", data.val());
});
firebase
.config()
.fetch(0) ...
远程配置默认缓存 12 小时,enableDeveloperMode 不会绕过缓存,它只是允许更频繁地刷新它。