This page shows you how to download, import, and configure the AppLovin MAX 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.
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.
To integrate the AppLovin SDK through CocoaPods:
pod 'AppLovinSDK'
pod install --repo-update
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:
ruby AppLovinQualityServiceSetup-ios.rb
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, except ALSdkSettings which contains mutable properties that can change 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
}];
// Create the initialization configuration
let initConfig = ALSdkInitializationConfiguration(sdkKey: "«SDK-key»") { builder in
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 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
}];
⋮
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
{
let initConfig = ALSdkInitializationConfiguration(sdkKey: "«SDK-key»") { builder in
builder.mediationProvider = ALMediationProviderMAX
}
// Initialize the SDK with the configuration
ALSdk.shared().initialize(with: initConfig) { sdkConfig in
// Start loading ads
}
⋮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
}];
// Create the initialization configuration
let initConfig = ALSdkInitializationConfiguration(sdkKey: "«SDK-key»") { builder in
builder.mediationProvider = ALMediationProviderMAX
builder.segmentCollection = MASegmentCollection { segmentCollectionBuilder in
segmentCollectionBuilder.add(MASegment(key: 849, values: [1, 3]))
}
}
// Configure the SDK settings if needed before or after SDK initialization.
let 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.isEnabled = true
settings.termsAndPrivacyPolicyFlowSettings.termsOfServiceURL = URL(string: "«https://your-company-name.com/terms-of-service»")
settings.termsAndPrivacyPolicyFlowSettings.privacyPolicyURL = URL(string: "«https://your-company-name.com/privacy-policy»")
// Initialize the SDK with the configuration
ALSdk.shared().initialize(with: initConfig) { sdkConfig in
// Start loading ads
}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.
Update your app’s Info.plist with network-specific identifiers.
See the SKAdNetwork documentation for instructions.
You must get consent from your users in certain jurisdictions on behalf of AppLovin’s monetization partners. You must also pass consent values to AppLovin. To learn how, review the Privacy–consent, age-related flags, and data APIs documentation.