gpt4 book ai didi

reactjs - 由于限制,react-native firebase fetch() 操作无法成功完成

转载 作者:行者123 更新时间:2023-12-03 14:12:06 25 4
gpt4 key购买 nike

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() 操作”可能是什么问题 ?

最佳答案

根据 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);
});

关于reactjs - 由于限制,react-native firebase fetch() 操作无法成功完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53405494/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com