Specifying Configuration Sources

Alternate Configuration Location

The SDK's start method expects to find a configuration file in your project named foresee_configuration.json by default. However, it is possible to specify an alternate location using the following method:

+ (void)startWithConfigurationFile:(NSString *)configFileName;

This is especially useful for debugging. Specify a custom configuration file when running locally like this:

#ifdef DEBUG
  [ForeSee startWithConfigurationFile:@"foresee_configuration_debug.json"];
  [ForeSee start]; // default config

Remote Configuration

It's also possible to specify a JSON string directly:

NSString *jsonConfig = @"{\"clientId\":\"your_client_id\",\"notificationType\":\"IMMEDIATE\",\"sessionReplayEnabled\":true,\"measures\":[{\"surveyId\":\"app_test_2\",\"launchCount\": 0}]}";
[ForeSee startWithConfigurationJson:jsonConfig];

This JSON string could originate anywhere (including one of your own servers). So this method can be used to load a remote configuration.


ForeSee iOS SDK v6.0.0 adds support for ForeSee-hosted remote configuration. Use the following method to start the SDK using a config file hosted with FCP:

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

You can also specify a specific version of the config:

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

A/B Testing

FCP supports A/B testing multiple configuration versions using:

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

Any number of tests can be specified, as long as the sum of all configured percentages is equal to 100. For example, if you've uploaded a config called mobilesdkdevstgtest with tests called a and b, then the SDK could be started like this:

[ForeSee addABTest:@"a" percentage:80];
[ForeSee addABTest:@"b" percentage:20];
[ForeSee startWithAppId:@"mobilesdkdevstgtest" version:@"1"];

Test a will be chosen 80% of the time. Test b will be chosen the remaining 20% of the time.