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 set }
  • 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 configured for the default Firebase 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
  • Returns the FIRRemoteConfig instance for your (non-default) Firebase appID. Note that Firebase analytics does not work for non-default app instances. 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(app: FIRApp) -> RemoteConfig
  • Unavailable. Use +remoteConfig instead.

  • Ensures initialization is complete and clients can begin querying for Remote Config values.

    Declaration

    Swift

    func ensureInitialized(completionHandler: @escaping RemoteConfigInitializationCompletion)

    Parameters

    completionHandler

    Initialization complete callback.

  • 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

    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.

    completionHandler

    Fetch operation callback.

  • Fetches Remote Config data and if successful, activates fetched data. Optional completion handler callback is invoked after the attempted activation of data, if the fetch call succeeded.

    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 fetchAndActivate(completionHandler: RemoteConfigFetchAndActivateCompletion? = nil)

    Parameters

    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).

    Declaration

    Swift

    func activate(completionHandler: RemoteConfigActivateCompletion? = nil)

    Parameters

    completionHandler

    Activate operation callback.

  • This method is deprecated. Please use -[FIRRemoteConfig activateWithCompletionHandler:] instead. 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.

    // 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.

    Declaration

    Swift