0

I use Firebase for A/B testing. I noticed that i cannot get remote configuration synchronously, because

 -(void)fetchWithCompletionHandler:(nullable FIRRemoteConfigFetchCompletion)completionHandler;

method of FIRRemoteConfig executes completion block on main thread. So i have no way to block main thread until it done.

P.S. I try to get remote configurations in didFinishLaunchingWithOptions of AppDelegate

Frank van Puffelen
  • 418,229
  • 62
  • 649
  • 645

1 Answers1

0

Like most modern web APIs Firebase Remote Config fetches data from its servers asynchronously and has no option to read synchronously. There is no way to say how long the fetch may take, so it's a bad idea to block the main thread. Completion handlers are honestly the best way to deal with data that is loaded asynchronously, and that must be available before the user can continue using the app.

A few related questions:

In general: making the user wait for updated configuration data, leads to a lesser user experience. For most apps you can just as easily start fetching updated remote config data when you start them, but instead of waiting the app immediately continue with the data it loaded last time. When the user restarts the app, it applies the previously loaded data, which then happens without any delay.

Frank van Puffelen
  • 418,229
  • 62
  • 649
  • 645