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
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}...}
- (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}⋮
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 'AppLovinMediationChartboostAdapter'pod 'AppLovinMediationFyberAdapter'pod 'AppLovinMediationGoogleAdManagerAdapter'pod 'AppLovinMediationGoogleAdapter'pod 'AppLovinMediationInMobiAdapter'pod 'AppLovinMediationIronSourceAdapter'pod 'AppLovinMediationVungleAdapter'pod 'AppLovinMediationFacebookAdapter'pod 'AppLovinMediationMintegralAdapter'pod 'AppLovinMediationByteDanceAdapter'pod 'AppLovinMediationSmaatoAdapter'pod 'AppLovinMediationUnityAdsAdapter'pod 'AppLovinMediationYandexAdapter'end