Search code examples
iosfirebasefirebase-remote-config

what is the difference between setting minimum interval and settting fetch withExpirationDuration in Firebase remote config?


from the documentation in here it is said that I have to set the setting for remote config like this

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

I assume the code above is used to always fetch the data from remote (to avoid 12 hours waiting, for testing). but I also find the code below to fetch the value using expiration duration

    let fetchDuration: TimeInterval = 0

    remoteConfig.fetch(withExpirationDuration: fetchDuration) { (status, error) in

        if let error = error {
            // show the error
        } else {
            // do something
        }

    }

what is the difference between these two ? which one is used for testing to avoid waiting 12 hours ?


Solution

  • The API documentation says this about withExpirationDuration:

    Override the (default or optionally set minimumFetchInterval property in FIRRemoteConfigSettings) minimumFetchInterval for only the current request, in seconds. Setting a value of 0 seconds will force a fetch to the backend.

    So it just overrides whatever you had in the settings.