RemoteConfig

class RemoteConfig : NSObject, NSFastEnumeration

Firebase Remote Config class. The shared instance method +remoteConfig can be created and used to fetch, activate and read config results and set default config results.

  • Last successful fetch completion time.

    Declaration

    Swift

    var lastFetchTime: Date? { get }
  • Last fetch status. The status can be any enumerated value from FIRRemoteConfigFetchStatus.

    Declaration

    Swift

    var lastFetchStatus: RemoteConfigFetchStatus { get }
  • Config settings are custom settings.

    Declaration

    Swift

    var configSettings: RemoteConfigSettings { get set }
  • Returns the FIRRemoteConfig instance shared throughout your app. This singleton object contains the complete set of Remote Config parameter values available to the app, including the Active Config and Default Config. This object also caches values fetched from the Remote Config Server until they are copied to the Active Config by calling activateFetched. When you fetch values from the Remote Config Server using the default Firebase namespace service, you should use this class method to create a shared instance of the FIRRemoteConfig object to ensure that your app will function properly with the Remote Config Server and the Firebase service.

    Declaration

    Swift

    class func remoteConfig() -> RemoteConfig
  • Unavailable. Use +remoteConfig instead.

  • Fetches Remote Config data with a callback. Call activateFetched to make fetched data available to your app.

    Note: This method uses a Firebase Instance ID token to identify the app instance, and once it’s called, it periodically sends data to the Firebase backend. (see [FIRInstanceID getIDWithHandler:]). To stop the periodic sync, developers need to call [FIRInstanceID deleteIDWithHandler:] and avoid calling this method again.

    Declaration

    Swift

    func fetch(completionHandler: RemoteConfigFetchCompletion? = nil)

    Parameters

    completionHandler

    Fetch operation callback.

  • Fetches Remote Config data and sets a duration that specifies how long config data lasts. Call activateFetched to make fetched data available to your app.

    Note: This method uses a Firebase Instance ID token to identify the app instance, and once it’s called, it periodically sends data to the Firebase backend. (see [FIRInstanceID getIDWithHandler:]). To stop the periodic sync, developers need to call [FIRInstanceID deleteIDWithHandler:] and avoid calling this method again.

    Declaration

    Swift

    func fetch(withExpirationDuration expirationDuration: TimeInterval, completionHandler: RemoteConfigFetchCompletion? = nil)

    Parameters

    expirationDuration

    Duration that defines how long fetched config data is available, in seconds. When the config data expires, a new fetch is required.

    completionHandler

    Fetch operation callback.

  • Applies Fetched Config data to the Active Config, causing updates to the behavior and appearance of the app to take effect (depending on how config data is used in the app). Returns true if there was a Fetched Config, and it was activated. Returns false if no Fetched Config was found, or the Fetched Config was already activated.

    Declaration

    Swift

    func activateFetched() -> Bool
  • Enables access to configuration values by using object subscripting syntax. This is used to get the config value of the default namespace.

    // Example:
    FIRRemoteConfig *config = [FIRRemoteConfig remoteConfig];
    FIRRemoteConfigValue *value = config[@"yourKey"];
    BOOL b = value.boolValue;
    NSNumber *number = config[@"yourKey"].numberValue;
    

    Declaration

    Swift

    subscript(key: String) -> RemoteConfigValue { get }
  • Gets the config value of the default namespace.

    Declaration

    Swift

    func configValue(forKey key: String?) -> RemoteConfigValue

    Parameters

    key

    Config key.

  • Gets the config value of a given namespace.

    Declaration

    Swift

    func configValue(forKey key: String?, namespace aNamespace: String?) -> RemoteConfigValue

    Parameters

    key

    Config key.

    aNamespace

    Config results under a given namespace.

  • Gets the config value of a given namespace and a given source.

    Declaration

    Swift

    func configValue(forKey key: String?, namespace aNamespace: String?, source: RemoteConfigSource) -> RemoteConfigValue

    Parameters

    key

    Config key.

    aNamespace

    Config results under a given namespace.

    source

    Config value source.

  • Gets all the parameter keys from a given source and a given namespace.

    Declaration

    Swift

    func allKeys