Firebase Remote Config value not updating

2,995 views
Skip to first unread message

Caveto Mario

unread,
Aug 5, 2020, 7:05:40 PM8/5/20
to Firebase Google Group

I am trying Firebase RemoteConfig sample with my iOS application. Sample is here: https://github.com/firebase/quickstart-ios/blob/b2e13eaa27b04567cbee3e758680a850bfd02188/config/LegacyConfigQuickstart/ConfigExample/ViewController.m

I am able to add Firebase Remote Config, A key and value on the console. I am able to retrieve the value first time (running app freshly) in my iOS application. This is working fine. My problem is, I want to update the value in Firebase console under Remote Config, i updated to a different value, but it doesn't get fetched in the app automatically or manually. Could someone guide, How to achieve this?

fetch code below.

- (void)fetchConfig {

    _label1.text = self.remoteConfig[kLoadingPhraseConfigKey].stringValue;

    long expirationDuration = 3600;

        [self.remoteConfig fetchWithExpirationDuration:expirationDuration completionHandler:^(FIRRemoteConfigFetchStatus status, NSError *error) {
        if (status == FIRRemoteConfigFetchStatusSuccess) {
          [self.remoteConfig activateFetched];
           
          NSString *result = self.remoteConfig[kWelcomeMessageConfigKey].stringValue;
          NSLog(@"Config fetched. result: %@", result);
        }
        else {
            NSLog(@"Config not fetched");
            NSLog(@"Error %@", error.localizedDescription);
        }
        [self displayWelcome];
    }];
}

- (void)displayWelcome {
    
    NSString *welcomeMessage = self.remoteConfig[kWelcomeMessageConfigKey].stringValue;
    if (self.remoteConfig[kWelcomeMessageCapsConfigKey].boolValue) {
        welcomeMessage = [welcomeMessage uppercaseString];
    }
    
    _label1.text = welcomeMessage;
    
    NSString *stringColor = self.remoteConfig[kIOSTitleColor].stringValue;
    NSLog(@"stringColor: %@", stringColor);
    UIColor *titleColor = [self colorWithHexString:stringColor];
    _label1.backgroundColor = titleColor;
    
}

Arthur Thompson

unread,
Aug 5, 2020, 10:59:34 PM8/5/20
to fireba...@googlegroups.com
This is likely due to the minimumFetchInterval. When developing it is useful to set this value to 0 so that every time fetch is called the latest available values are retrieved from the server. However in a production app using 0 as the minimumFetchInterval is likely not what you want to do since it will cause the user's device to make unnecessary network calls to the Firebase backend.

In this case expirationDuration is set to 3600 seconds (1 hour) so you would have to wait that amount of time before the client fetches the updated value from the server. Try setting it to 0 for development purposes.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/59660416-8991-46dd-ad9b-fc95e1a77b57o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages