FIRRemoteConfig


@interface FIRRemoteConfig : 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

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) NSDate *lastFetchTime;
  • Last fetch status. The status can be any enumerated value from FIRRemoteConfigFetchStatus.

    Declaration

    Objective-C

    @property (readonly, assign, nonatomic)
        FIRRemoteConfigFetchStatus lastFetchStatus;
  • Config settings are custom settings.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nonnull)
        FIRRemoteConfigSettings *configSettings;
  • 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

    Objective-C

    + (nonnull FIRRemoteConfig *)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

    Objective-C

    + (nonnull FIRRemoteConfig *)remoteConfigWithApp:(nonnull FIRApp *)app;
  • Unavailable. Use +remoteConfig instead.

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Ensures initialization is complete and clients can begin querying for Remote Config values.

    Declaration

    Objective-C

    - (void)ensureInitializedWithCompletionHandler:
        (nonnull FIRRemoteConfigInitializationCompletion)completionHandler;

    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

    Objective-C

    - (void)fetchWithCompletionHandler:
        (nullable FIRRemoteConfigFetchCompletion)completionHandler;

    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

    Objective-C

    - (void)fetchWithExpirationDuration:(NSTimeInterval)expirationDuration
                      completionHandler:(nullable FIRRemoteConfigFetchCompletion)
                                            completionHandler;

    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

    Objective-C

    - (void)fetchAndActivateWithCompletionHandler:
        (nullable FIRRemoteConfigFetchAndActivateCompletion)completionHandler;

    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

    Objective-C

    - (void)activateWithCompletionHandler:
        (nullable FIRRemoteConfigActivateCompletion)completionHandler;

    Parameters

    completionHandler

    Activate operation callback.

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

    Objective-C

    - (BOOL)activateFetched;
  • 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

    Objective-C

    - (nonnull FIRRemoteConfigValue *)objectForKeyedSubscript:
        (nonnull NSString *)key;