PFConfig Class Reference

Inherits from NSObject
Declared in PFConfig.h

Overview

PFConfig is a representation of the remote configuration object. It enables you to add things like feature gating, a/b testing or simple “Message of the day”.

Current Config

+ currentConfig

Returns the most recently fetched config.

+ (PFConfig *)currentConfig

Return Value

Current, last fetched instance of PFConfig.

Discussion

If there was no config fetched - this method will return an empty instance of PFConfig.

Declared In

PFConfig.h

Retrieving Config

+ getConfig

Gets the PFConfig object synchronously from the server.

+ (nullable PFConfig *)getConfig

Return Value

Instance of PFConfig if the operation succeeded, otherwise nil.

Declared In

PFConfig.h

+ getConfig:

Gets the PFConfig object synchronously from the server and sets an error if it occurs.

+ (nullable PFConfig *)getConfig:(NSError **)error

Parameters

error

Pointer to an NSError that will be set if necessary.

Return Value

Instance of PFConfig if the operation succeeded, otherwise nil.

Declared In

PFConfig.h

+ getConfigInBackground

Gets the PFConfig asynchronously and sets it as a result of a task.

+ (BFTask PF_GENERIC ( PFConfig *) *)getConfigInBackground

Return Value

The task, that encapsulates the work being done.

Declared In

PFConfig.h

+ getConfigInBackgroundWithBlock:

Gets the PFConfig asynchronously and executes the given callback block.

+ (void)getConfigInBackgroundWithBlock:(nullable PFConfigResultBlock)block

Parameters

block

The block to execute. It should have the following argument signature: ^(PFConfig *config, NSError *error).

Declared In

PFConfig.h

Parameters

– objectForKey:

Returns the object associated with a given key.

- (nullable id)objectForKey:(NSString *)key

Parameters

key

The key for which to return the corresponding configuration value.

Return Value

The value associated with key, or nil if there is no such value.

Declared In

PFConfig.h

– objectForKeyedSubscript:

Returns the object associated with a given key.

- (nullable id)objectForKeyedSubscript:(NSString *)keyedSubscript

Parameters

keyedSubscript

The keyed subscript for which to return the corresponding configuration value.

Return Value

The value associated with key, or nil if there is no such value.

Discussion

This method enables usage of literal syntax on PFConfig. E.g. NSString *value = config[@"key"];

See Also

Declared In

PFConfig.h