这是我设置远程配置的方法.
Future<RemoteConfig> setupRemoteConfig() async { final RemoteConfig remoteConfig = await RemoteConfig.instance; // Enable developer mode to relax fetch throttling remoteConfig.setConfigSettings(RemoteConfigSettings(deBUGMode: true)); remoteConfig.setDefaults(<String,dynamic>{ 'categorIEs': "food,drink",}); await remoteConfig.fetch(expiration: const Duration(hours: 5)); await remoteConfig.activateFetched(); return remoteConfig;}
此代码抛出以下异常:
Exception: Unable to fetch remote config
在我的控制台中它说:
W/FirebaseRemoteConfig(10456): IPC failure: 6503:NOT_AVAILABLE
我怎样才能解决这个问题?
解决方法 使用Try Catch包装你的fetch()和activateFetched()API调用try { // Using default duration to force fetching from Remote Server. await remoteConfig.fetch(expiration: const Duration(seconds: 0)); await remoteConfig.activateFetched(); } on FetchThrottledException catch (exception) { // Fetch throttled. print(exception); } catch (exception) { print( 'Unable to fetch remote config. Cached or default values will be ' 'used'); }
请参见此处的官方示例:https://github.com/flutter/plugins/blob/master/packages/firebase_remote_config/example/lib/main.dart
总结以上是内存溢出为你收集整理的dart – Flutter应用程序中的远程配置会在fetch上引发异常全部内容,希望文章能够帮你解决dart – Flutter应用程序中的远程配置会在fetch上引发异常所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)