SDK Integration

Follow the below steps to integrate the Real-time CDP SDK in the iOS app:

  1. (Conditional) Swift Integration

    This step is needed only for a project written in Swift. If you are using Objective-C, continue to SDK Integration.

    Import the SDK as a module rather than using a bridging header. If you are unable to do that, use a bridging header instead. In that case:

    1. Add bridging-header.h to your project.

    2. Add the path to bridging-header.h in the Objective-C Bridging Header section of your project Build Settings.

    Alternatively, you can also append the contents of bridging-header.h to your existing Bridging Header file.

  2. SDK Integration

    Import TargetOne.h to your AppDelegate.h file.

    Objective-C

    Copy
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
    T1Config *t1Config = [T1Config new];
    t1Config.enableNotification = YES;
    t1Config.enableLocation = YES;
    t1Config.tenantHash = @"TENANT_HASH";
    t1Config.urlPrefix = @"rcdp-us-east-1/rcdp-app2";
    t1Config.accessToken = "ACCESS_TOKEN";
       
    [TargetOne sharedInstance] initialize: t1Config];
    …..
    }

    Swift

    Copy
    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject:AnyObject]?) -> Bool {
        ...
            targetone=TargetOne.sharedInstance()
            let t1Config = T1Config()
            t1Config.enableNotification = true
            t1Config.enableLocation = true
            t1Config.tenantHash = "TENANT_HASH"
            t1Config.urlPrefix = "rcdp-us-east-1/rcdp-app2"
            t1Config.accessToken = "ACCESS_TOKEN"
            targetone?.initialize(t1Config)
        ...
    }