由于节流,react-native firebase fetch() 操作无法成功完成
Posted
技术标签:
【中文标题】由于节流,react-native firebase fetch() 操作无法成功完成【英文标题】:react-native firebase fetch() operation cannot be completed successfully ,due to throttling 【发布时间】:2019-04-23 15:13:47 【问题描述】:import firebase from "react-native-firebase";
remoteKey = "testJSON"
firebase
.config()
.fetch(0)
.then(() =>
return firebase.config().activateFetched();
)
.then(activated =>
if (!activated) console.log("Fetched data not activated");
return firebase.config().getKeysByPrefix(remoteKey);
);
我在我的 react native 项目中的 App.js 中调用它,但它给出了错误“fetch() 操作无法完成,由于节流” 可能是什么问题 ?
【问题讨论】:
您是否尝试在互联网上搜索解决方案?你试过什么? 【参考方案1】:根据 firebase 文档,这意味着配置获取受到限制 https://firebase.google.com/docs/reference/ios/firebaseremoteconfig/api/reference/Enums/FIRRemoteConfigFetchStatus?hl=vi
The Remote Config library has a client-side throttle to ensure you don’t ping the service too frequently. By setting your fetchDuration to 0, you’ll hit this throttle and your library will stop making calls.
尝试将 .fetch(0) 更改为 .fetch() 或使用以下函数激活开发模式
func activateDebugMode()
let debugSettings = FIRRemoteConfigSettings(developerModeEnabled: true)
FIRRemoteConfig.remoteConfig().configSettings = debugSettings!
并在之前调用它。
import firebase from "react-native-firebase";
remoteKey = "testJSON";
firebase
.config()
.fetch()
.then(() =>
return firebase.config().activateFetched();
)
.then(activated =>
if (!activated) console.log("Fetched data not activated");
return firebase.config().getKeysByPrefix(remoteKey);
);
【讨论】:
以上是关于由于节流,react-native firebase fetch() 操作无法成功完成的主要内容,如果未能解决你的问题,请参考以下文章
react-native,“abortOnError false”,但由于 lint 错误,android 构建失败
React-native 0.65 (targetSdk=30) android build 由于 react-native-reanimated 而失败
由于谷歌播放控制台的新政策,React-native Android 应用程序不断拒绝:敏感信息