2. Initialize the iOS SDK

Once the SDK has been added to your project, you will need to initialize it. The initialization process will run on a background thread. This will prepare the SDK for interactions with the user, and your application.

SDK initialization requires a Configuration ID which is generated in Console. To learn more, see Implementing ATS Mobile SDK.

Consent Requirements

The SDK will automatically perform a geolocation check to ensure consent is properly set for GDPR and CCPA. Learn what this means for your application below:

  • To successfully initialize and use the SDK, user consent needs to be present per IAB standards (i.e. in UserDefaults).
  • The SDK will fail to initialize if there is no consent given for TCF purposes 1 to 10 and if LiveRamp is not listed as a vendor (ID 97).
  • If you are running the SDK outside of the GDPR and CCPA legislations, command the SDK to proceed without checking for consent (Swift): LRAts.shared.hasConsentForNoLegislation = true.
  • Dynamic TCF and CCPA consent monitoring and handling are applied. This ensures if consent is revoked, SDK will reset (clear cached data) and all SDK-related APIs will stop working. The SDK will automatically re-initialise and APIs will work again if consent is given during lifecycle of the application.
  • For iOS devices, LiveRamp requires the user to select Allow Tracking for envelopes to be successfully fetched.

Learn more about consent requirements and best practices for each region during initialization.

How to Initialize the iOS SDK

1. Import the SDK module to where you want to use it

import LRAtsSDK
#import <LRAtsSDK/LRAtsSDK-Swift.h>

2. (Optional, but recommended) Implement the SDK delegate methods. This will allow the host application to track the SDK initialization status

LRAts.shared.delegate = self
[[LRAts shared] delegate] = self;

3. Prepare the SDK Configuration
Create configuration object by providing your Config ID (appID).

let lrAtsConfiguration = LRAtsConfiguration(appId: <#String#>)
LRAtsConfiguration *lrAtsConfiguration = [[LRAtsConfiguration alloc] initWithAppId:<#(NSString * _Nonnull)#>];

4. Initialize the SDK
Initialize SDK with LRAtsConfiguration object. The initialization runs on a background thread to avoid blocking your UI.


Check for ATT consent before initializing our SDK.

LRAts.shared.initialize(with: lrAtsConfiguration) { success, error in
    if success {
        print("SDK is Ready")
    } else {
        print("SDK init error: \(String(describing: error))")
[[LRAts shared] initializeWith:lrAtsConfiguration completion:^(BOOL success, NSError * _Nullable error) {
    if (success) {
        NSLog(@"init successful");
    } else {
        NSLog(@"init failure");


Init with Unapproved ATS Placement

After the initialization process is complete, if the ATS placement tied to the Config ID is still not yet approved, the SDK will return fake data which should only be used for testing. Information regarding the placement status can be found in the log output of the SDK.

What’s Next