Search code examples
swiftfirebasefirebase-remote-config

Firebase RemoteConfigSettings doesn't reflect minimumFetchInterval changes


I'm trying to change the minimumFetchInterval for my RemoteConfigSettings. I set the value to 0 but the value doesn't update. As a workaround, I can create a new RemoteConfigSettings object, set the value there, and assign the settings to the remoteConfig instance.

let remoteConfig = RemoteConfig.remoteConfig()
remoteConfig.configSettings.minimumFetchInterval = 0

Reading back minimumFetchInterval still shows the default of 43200.

The header is defined in Obj-C as: @property(nonatomic, assign) NSTimeInterval minimumFetchInterval; So I would expect the value to reflect assignments.

This does work:

remoteConfig = RemoteConfig.remoteConfig()

let configSettings = RemoteConfigSettings()
configSettings.minimumFetchInterval = 0
remoteConfig.configSettings = configSettings

I am able to work around this issue, but this should be fixed. Am I missing something, or should I continue to expect these APIs to be incorrect?

The documentation of the RemoteConfigSettings class doesn't even mention the minimumFetchInterval property, but their how to docs do.


Solution

  • As mentioned in the link, Firebase remote config minimum fetch interval depends on 3 parameters:

    1. parameter passed in fetch(long seconds) call.

    2. The parameter in FirebaseRemoteConfigSettings.setMinimumFetchIntervalInSeconds(long seconds)

    3. Default value of 43200 seconds which is 12 hours.

    When using FirebaseRemoteConfigSettings.setMinimumFetchIntervalInSeconds(long seconds)

    you need to do it using "Builder" pattern & set it in FirebaseRemoteConfigSettings as

    get() operation on FirebaseRemoteConfigSettings does not return the original object being used by the SDK.

    Also, you can see the same in sample project provided by Firebase team here. i.e.

    let settings = RemoteConfigSettings()
    settings.minimumFetchInterval = 0
    remoteConfig.configSettings = settings