Initialize the iOS SDK with a NSDictionary object

Implement the iOS SDK without using the MceConfig.json file

Overview

You can initialize the SDK without using the MceConfig.json file. Use the NSDictionary object to install the SDK or to change the configuration at runtime. The NSDictionary object initializes the SDK and replaces the MCEConfig.json file.

Before you begin

Manually integrate the SDK with your app. If automatically integrated, the SDK cannot start late enough to change the configuration. For more information, see Add the iOS SDK to your app.

📘

Tip:

You can review the sample project that shows how to install the NSDictionary object. The sample project is included in the SDK package. Go to samples/ObjC Manual Dictionary Sample/Manual Dictionary Sample.xcodeproj.

Initialize the iOS SDK

  1. Modify your application delegate where the SDK is initialized. Replace '[MCESdk.sharedInstance handleApplicationLaunch];' in the 'application:didfinishlaunchingwithoptions:' method with the following code:
NSDictionary * config = @{
    //Normal MceConfig.json keys and values here, ie:
    @"appKey": @{
        @"dev": @"INSERT DEV APPKEY HERE",
        @"prod": @"INSERT PROD APPKEY HERE"
    },
    ... add the rest of your configuration...
};
[MCESdk.sharedInstance handleApplicationLaunchWithConfig: config];
  1. Modify your notification service to initialize the SDK configuration. Add the following code to the init method of the Notification Service subclass:
-(instancetype) init {
    NSDictionary * config = @ {
        //Normal MceConfig.json keys and values here, ie:
        @”
        appKey”: @

        {@”
            dev”: @”INSERT DEV APPKEY HERE”,
            @”prod”: @”INSERT PROD APPKEY HERE”
        },
        …add the rest of your configuration…
    };
    [MCEConfig sharedInstanceWithDictionary: config];
    return [super init];
}

Did this page help you?