iOS SDK Integration
Integrating the SDK
Cocoapods
You can download the SDK through CocoaPods as a dependency. The SDK requires the minimum iOS deployment target to be iOS 9.0 or above. It also requires Xcode version 13.2.1 or above.
- Add the following line to your Podfile:
pod 'AppLovinSDK'
- Run the following on the command line:
pod install --repo-update
If you prefer to integrate using Swift Package Manager, follow the instructions:
- Add it to the dependencies of your Package.swift:
dependencies: [.package(url: "https://github.com/AppLovin/AppLovin-MAX-Swift-Package.git", .upToNextMajor(from: "10.3.6"))]
- Enable the -ObjC flag in Xcode: click on your project settings, go to Build Settings, search for Other Linker Flags and add -ObjC.
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.
iOS 14 Support
SKAdNetwork
Update app's Info.plist with network-specific identifiers.
- A
GADApplicationIdentifier
key with a string value of your AdMob app ID. - A
SKAdNetworkItems
key with SKAdNetworkIdentifier values. - You can find SKAdNetwork values here. Copy and paste all of these into your Info.plist file.
Initialize the SDK
Swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) - Bool{let initConfig = ALSdkInitializationConfiguration(sdkKey: "LViME7X7lxKv-i-F_7zqiS5mftIkLozQDU3EVbAPn80KLVP7ImNA15ows7wdxZeVHHT-R_lIJO9TwH5bAxm7_N") { builder inbuilder.mediationProvider = ALMediationProviderMAX}// Initialize the SDK with the configurationALSdk.shared().initialize(with: initConfig) { sdkConfig in// Start loading ads}...}
Objective-C
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{// Create the initialization configurationALSdkInitializationConfiguration *initConfig = [ALSdkInitializationConfiguration configurationWithSdkKey: @"LViME7X7lxKv-i-F_7zqiS5mftIkLozQDU3EVbAPn80KLVP7ImNA15ows7wdxZeVHHT-R_lIJO9TwH5bAxm7_N" builderBlock:^(ALSdkInitializationConfigurationBuilder *builder) {builder.mediationProvider = ALMediationProviderMAX;}];// Initialize the SDK with the configuration[[ALSdk shared] initializeWithConfiguration: initConfig completionHandler:^(ALSdkConfiguration *sdkConfig) {// Start loading ads}⋮
Enable Creative Debugger
Swift
ALSdk.shared().settings.isCreativeDebuggerEnabled = true
Objective-C
[ALSdk shared].settings.creativeDebuggerEnabled = YES;
Integrating Mediation Networks
Add following libraries to your Podfile and run the command `pod install --repo-update
# Settingsuse_frameworks!inhibit_all_warnings!# Podstarget 'YOUR_PROJECT_NAME' dopod 'AppLovinSDK'pod 'AmazonPublisherServicesSDK'pod 'AppLovinMediationAmazonAdMarketplaceAdapter'pod 'AppLovinMediationBigoAdsAdapter'pod 'AppLovinMediationChartboostAdapter'pod 'AppLovinMediationFyberAdapter'pod 'AppLovinMediationGoogleAdManagerAdapter'pod 'AppLovinMediationGoogleAdapter'pod 'AppLovinMediationInMobiAdapter'pod 'AppLovinMediationIronSourceAdapter'pod 'AppLovinMediationVungleAdapter'pod 'AppLovinMediationFacebookAdapter'pod 'AppLovinMediationMintegralAdapter'pod 'AppLovinMediationMolocoAdapter'pod 'AppLovinMediationByteDanceAdapter'pod 'AppLovinMediationSmaatoAdapter'pod 'AppLovinMediationUnityAdsAdapter'pod 'AppLovinMediationYandexAdapter'pod 'AppLovinMediationYSONetworkAdapter'pod 'AppLovinMediationPubMaticAdapter'end
Initialize Amazon SDK
Objective-C
[[DTBAds sharedInstance] setAppKey: appId];DTBAdNetworkInfo *adNetworkInfo = [[DTBAdNetworkInfo alloc] initWithNetworkName: DTBADNETWORK_MAX];[DTBAds sharedInstance].mraidCustomVersions = @[@"1.0", @"2.0", @"3.0"];[[DTBAds sharedInstance] setAdNetworkInfo: adNetworkInfo];[DTBAds sharedInstance].mraidPolicy = CUSTOM_MRAID;
Swift
DTBAds.sharedInstance().setAppKey("e361787b-c530-4cda-8b29-bd72ae789388")let adNetworkInfo = DTBAdNetworkInfo(networkName: DTBADNETWORK_MAX)DTBAds.sharedInstance().mraidCustomVersions = ["1.0", "2.0", "3.0"]DTBAds.sharedInstance().setAdNetworkInfo(adNetworkInfo)DTBAds.sharedInstance().mraidPolicy = CUSTOM_MRAID
Consent Management
Google UMP
Add the dependency for the Google UMP SDK to your app's target in your Podfile:
target 'YourPorjectName' dopod 'Google-Mobile-Ads-SDK'end
In your app's Info.plist
file, create a new key named NSUserTrackingUsageDescription
of type String
. This string is how you inform your users why the app is asking permission to use data that tracks the user or the device. It is recomended to set the value to "This uses device information for more personalized ads and consent."
To enable AppLovin MAX Google UMP consent flow via plist file, add a new property list file named AppLovin-Setting.plist
to your project's main.target and add the key-value pairs as shown below: