Skip to content

Integration

This page shows you how to download, import, and configure the AppLovin MAX SDK.

Download the Latest SDK

You can download the SDK through CocoaPods as a dependency. If you prefer to integrate manually, follow the instructions here. If you prefer to integrate using Swift Package Manager, follow the instructions here.

The SDK requires the minimum iOS deployment target to be iOS 12.0 or above. It also requires Xcode version 15 or above.

To receive release updates, subscribe to the AppLovin iOS MAX SDK GitHub repository.

Swift Compatibility

To ensure your build is compatible with artifacts that contain Swift, set Build Settings > Always Embed Swift Standard Libraries to YES.

If you use Swift and build for iOS 12.2.0 or earlier, add /usr/lib/swift to Build Settings > Runpath Search Paths. This prevents issues with libswiftCore.dylib.

CocoaPods

To integrate the AppLovin SDK through CocoaPods:

  1. Add the following line to your Podfile:
    pod 'AppLovinSDK'
  2. Run the following on the command line:
    Terminal window
    pod install --repo-update

Integrate Custom SDK Adapters

AppLovin Exchange (ALX) supports a custom adapter for LinkedIn. Integration instructions are below, and more information can be found here.

To install the adapter:

  1. Add the following line to your Podfile:
    pod 'AppLovinDSPLinkedInAdapter'
  2. Run the following on the command line:
    Terminal window
    pod install --repo-update

Enable Ad Review

To enable the MAX Ad Review service, you must log in to your AppLovin account. Then download AppLovinQualityServiceSetup-ios.rb and move it into your project folder. Open a terminal window, cd into your project folder and run:

Terminal window
ruby AppLovinQualityServiceSetup-ios.rb

Initialize the SDK

Create the SDK Initialization Configuration

Before you initialize the SDK, create an initialization configuration object for the SDK in your app delegate’s application:applicationDidFinishLaunching: method.

This configuration object allows you to configure the properties that the SDK will initialize with. These initialization properties are immutable, with the exception of ALSdkSettings which contains mutable properties that can be changed during the lifetime of the app.

// Create the initialization configuration
ALSdkInitializationConfiguration *initConfig = [ALSdkInitializationConfiguration configurationWithSdkKey: @"«SDK-key»" builderBlock:^(ALSdkInitializationConfigurationBuilder *builder) {
builder.mediationProvider = ALMediationProviderMAX;
// Perform any additional configuration/setting changes
}];

You can find your SDK key in the Account > General > Keys section of the AppLovin dashboard.

Initialize the SDK

Initialize the AppLovin SDK with the initialization configuration object. Do this at startup. This maximizes the time the SDK can take to cache mediated network ads, which results in a better user experience.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Create the initialization configuration
ALSdkInitializationConfiguration *initConfig = [ALSdkInitializationConfiguration configurationWithSdkKey: @"«SDK-key»" builderBlock:^(ALSdkInitializationConfigurationBuilder *builder) {
builder.mediationProvider = ALMediationProviderMAX;
}];
// Initialize the SDK with the configuration
[[ALSdk shared] initializeWithConfiguration: initConfig completionHandler:^(ALSdkConfiguration *sdkConfig) {
// Start loading ads
}];

Example

Below is a sample integration:

// Create the initialization configuration
ALSdkInitializationConfiguration *initConfig = [ALSdkInitializationConfiguration configurationWithSdkKey: @"«SDK-key»" builderBlock:^(ALSdkInitializationConfigurationBuilder *builder) {
builder.mediationProvider = ALMediationProviderMAX;
builder.segmentCollection = [MASegmentCollection segmentCollectionWithBuilderBlock:^(MASegmentCollectionBuilder *builder) {
[builder addSegment: [[MASegment alloc] initWithKey: @(849) values: @[@(1), @(3)]]];
}];
}];
// Configure the SDK settings if needed before or after SDK initialization.
ALSdkSettings *settings = [ALSdk shared].settings;
settings.userIdentifier = @"«user-ID»";
[settings setExtraParameterForKey: @"uid2_token" value: @"«token-value»"];
// Note: you may also set these values in your Info.plist
settings.termsAndPrivacyPolicyFlowSettings.enabled = YES;
settings.termsAndPrivacyPolicyFlowSettings.termsOfServiceURL = [NSURL URLWithString: @"«https://your-company-name.com/terms-of-service»"];
settings.termsAndPrivacyPolicyFlowSettings.privacyPolicyURL = [NSURL URLWithString: @"«https://your-company-name.com/privacy-policy»"];
// Initialize the SDK with the configuration
[[ALSdk shared] initializeWithConfiguration: initConfig completionHandler:^(ALSdkConfiguration *sdkConfig) {
// Start loading ads
}];

iOS 14 Support

In iOS 14, Apple introduced global privacy policy changes. Apple requires applications to comply with these new policies. If you fail to comply, you may lose revenue. This section explains how to comply.

SKAdNetwork

Update your app’s Info.plist with network-specific identifiers. See the SKAdNetwork documentation for instructions.

You must obtain consent from your users in certain jurisdictions on behalf of AppLovin’s monetization partners. You must also correctly pass consent values to AppLovin. To learn how to do these things, review the Privacy–Consent, Age-Related Flags, and Data APIs documentation.