ForeSee Class Reference

Inherits from NSObject
Declared in ForeSee.h

Overview

The ForeSee class provides the main interface to the ForeSee SDK.

To use the ForeSee framework, simply call [ForeSee start]; in your application:didFinishLaunchingWithOptions: and it will automatically parse your configuration file and start the Trigger module. (Other start methods are available. See documentation.)

Configuration

Most configuration is done through the foresee_configuration.json file. See the documentation for all available configuration options.

Debugging

When testing your configuration, it is recommended you enable debug log mode. Useful information regarding internal state will be posted to the console for inspection.

CPPs

CPPs (Customer Passed Parameters) are key/value pairs that you can optionally attach to completed surveys.

+ start

Starts the SDK.

+ (void)start

Discussion

Behavior of the module is defined in the foresee_configuration.json file.

Declared In

ForeSee.h

+ startWithConfigurationFile:

Starts the SDK using a custom configuration file.

+ (void)startWithConfigurationFile:(NSString *)configFileName

Parameters

configFileName

The name of the configuration file to use when loading modules

Discussion

Behavior of the module is defined in the named configuration file in your project.

See Also

Declared In

ForeSee.h

+ startWithConfigurationJson:

Starts the SDK using custom configuration JSON.

+ (void)startWithConfigurationJson:(NSString *)json

Parameters

json

The configuration JSON to use when loading modules

Discussion

Behavior of the module is defined by the string provided.

See Also

Declared In

ForeSee.h

+ startWithAppId:

Starts the SDK using the given application identifier.

+ (void)startWithAppId:(NSString *)appId

Parameters

appId

The application to start

See Also

Declared In

ForeSee.h

+ startWithAppId:version:

Starts the SDK using the given remote configuration details.

+ (void)startWithAppId:(NSString *)appId version:(NSString *)version

Parameters

appId

The application to start

version

The version of the application to start

See Also

Declared In

ForeSee.h

+ setDelegate:

Registers an optional ForeSeeDelegate for the SDK

+ (void)setDelegate:(id<ForeSeeDelegate>)delegate

Declared In

ForeSee.h

+ addABTest:percentage:

Add an A/B test

+ (BOOL)addABTest:(NSString *)name percentage:(NSInteger)percentage

Parameters

name

a NSString represents the name of the test

percentage

a NSInteger value indicating the percentage for that test. The sum of all the test percentages must be 100.

Return Value

YES if the percentage value is between 0 and 100, NO otherwise

Availability

v6.0.0

Declared In

ForeSee.h

+ version

Gets the version of the SDK

+ (NSString *)version

Declared In

ForeSee.h

+ setDebugLogEnabled:

Sets whether or not to enable debug logging

+ (void)setDebugLogEnabled:(BOOL)enabled

Parameters

enabled

YES to enable debug logging, NO to disable.

Discussion

Debug logging will print useful state information to the console for inspection. By default, debug logging is disabled

Declared In

ForeSee.h

+ isDebugLogEnabled

Returns whether or not debug logging is enabled

+ (BOOL)isDebugLogEnabled

Return Value

YES if enabled, NO otherwise

Declared In

ForeSee.h

+ setEventLogEnabled:

Sets whether or not to enable remote event logging

+ (void)setEventLogEnabled:(BOOL)enabled

Parameters

enabled

YES to enable event logging, NO to disable.

Discussion

Event logging captures and transmits significant events that occur during the SDK life cycle. By default, event logging is enabled and it is highly recommended that this logging remain enabled in release builds.

Declared In

ForeSee.h

+ isEventLogEnabled

Returns whether or not event logging is enabled

+ (BOOL)isEventLogEnabled

Return Value

YES if enabled, NO otherwise

Declared In

ForeSee.h

+ resetState

Erases all stored counts and state in the SDK; resets the SDK state to be active and recording. This should only be used for specific debugging or testing purposes; it should not be used in production code.

+ (void)resetState

Declared In

ForeSee.h

+ setConfigurationContainer:

Set remote configuration container

+ (void)setConfigurationContainer:(NSString *)name

Parameters

name

a specific container name.

Discussion

When testing your remote configuration of the ForeSee SDK, it may be useful to try out your new configuration in a non-production container first. This method tells the SDK to look for the remote configuration in a specific container. By default the container name is “production”

Declared In

ForeSee.h

+ configurationContainer

Get remote configuration container

+ (NSString *)configurationContainer

Return Value

a string indicating the current using configuration container name

Declared In

ForeSee.h

+ setSupportedConfigurationLocales:defaultLocale:

Set supported configuration locales and the default locale

+ (void)setSupportedConfigurationLocales:(NSArray<NSString*> *)locales defaultLocale:(NSString *)defaultLocale

Parameters

locales

a NSArray of supported configuration locales.

defaultLocale

the default locale.

Discussion

By default only “en” is supported

Declared In

ForeSee.h

+ defaultConfigurationLocale

Get the default supported configuration locale

+ (NSString *)defaultConfigurationLocale

Return Value

the default supported configuration locale.

Declared In

ForeSee.h

+ configurationLocales

Get the supported configuration locales

+ (NSArray<NSString*> *)configurationLocales

Return Value

a NSArray of supported configuration locales.

Declared In

ForeSee.h

+ setCPPValue:forKey:

Adds a CPP to be sent to the server along with a completed survey

+ (void)setCPPValue:(NSString *)value forKey:(NSString *)key

Parameters

value

The value to transmit

key

The key identifying the value

Discussion

CPPs are unique to their provided key. If you set a value for an existing key, the old value will simply be overwritten.

Declared In

ForeSee.h

+ setCPPValueFromArray:forKey:

Adds a list of CPP values to be sent to the server along with a completed survey. The values will be sent as a comma-separated list.

+ (void)setCPPValueFromArray:(NSArray<NSString*> *)value forKey:(NSString *)key

Parameters

value

The values to transmit

key

The key identifying the values

Discussion

CPPs are unique to their provided key. If you set a value for an existing key, the old value will simply be overwritten.

Declared In

ForeSee.h

+ appendCPPValue:forKey:

Adds a CPP value to the end of the list of values for the given key. If no such list exists, then it will be created. If the key already contains a non-array value, then that value will be destroyed and a new list will be created.

+ (void)appendCPPValue:(NSString *)value forKey:(NSString *)key

Parameters

value

The value to add

key

The key identifying the values

Discussion

The values in the resulting array will be sent as a comma-separated list.

Declared In

ForeSee.h

+ CPPValueForKey:

Retrieves the CPP value associated with the given key (or nil, if no such key exists)

+ (NSString *)CPPValueForKey:(NSString *)key

Parameters

key

The key to look for

Return Value

the CPP’s value, if one exists; nil, if it doesn’t

Declared In

ForeSee.h

+ allCPPs

Retrieves a dictionary containing all existing CPPs, where the keys are each CPP’s key and the values are each CPP’s value as a string. If the key is assoicated with a list of values, then the value for that key will be a comma-separated list (exactly as they’re stored on the backend).

+ (NSDictionary *)allCPPs

Return Value

a dictionary containing all existing CPPs

Declared In

ForeSee.h

+ removeCPPValueForKey:

Remove a CPP

+ (void)removeCPPValueForKey:(NSString *)key

Parameters

key

The key of the value to remove.

Declared In

ForeSee.h

+ setUserProfile:

Sets a user profile.

+ (void)setUserProfile:(FSUserProfile *)userProfile

Parameters

userProfile

an FSUserProfile object

Discussion

The provided user profile is used to associate a specific user with events during logging.

Declared In

ForeSee.h