Skip to main content

Step 1. Import SDK

  1. Podfile configuration
Show Podfile
Podfile

  1. Call pod install

Call $ pod install to install CocoaPods dependencies or $ pod update to update. If you do not have an installed pod, Install CocoaPods to simplify dependency management

sudo gem install cocoapods
  1. Open your project using .xcworkspace file from now on.

Step 2. Prepare Your Application

Add SKAdNetworkIds

important

To ensure SKAdNetwork packages can be correctly scanned, follow the Semantic Versioning (SemVer) format for your app version.

Ad networks used in Appodeal mediation support conversion tracking using Apple's SKAdNetwork, which means ad networks are able to attribute an app install even when IDFA is unavailable. To enable this functionality, you will need to update the SKAdNetworkItems key with an additional dictionary in your Info.plist.

info

If you are using Xcode 14+ and SwiftUI in your app, then you can notice that there is no Info.plist in project navigator by default.

You need to go to Target → Info tab → Custom iOS Target Properties and make any changes to it by simply adding an empty line so the Info.plist file shows up in your project navigator.

  1. Select Info.plist in the Project navigator in Xcode
  2. Right-click on Info.plist file → Open as → Source Code
  3. Copy the SKAdNetworkItems from below and paste it into your Info.plist file
There is SKAdNetworks IDs in Info.plist format
<key>SKAdNetworkItems</key>
<array>

</array>

Configure App Transport Security Settings

In order to serve ads, the SDK requires you to allow arbitrary loads. Set up the following keys in Info.plist of your app:

  1. Go to your Info.plist file, then press Add+ anywhere in the first column of the key list.
  2. Add App Transport Security Settings key and set its type to Dictionary in the second column.
  3. Press Add+ at the end of the name App Transport Security Settings key and choose Allow Arbitrary loads. Set its type to Boolean and its value to Yes.

You can also add the key to your Info.plist directly, using this code:

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

Configure AdMob

To improve ad performance the following entries should be added (if you use AdMob):

  1. GADApplicationIdentifier - When including AdMob in your project, you must also add your AdMob app ID to your info.plist. Use the key GADApplicationIdentifier with the value being your AdMob app ID. For more information about Admob sync check out our Admob guide.
  2. NSUserTrackingUsageDescription - Starting from iOS 14, using IDFA requires permission from the user. The following entry must be added in order to improve ad performance.
  3. NSCalendarsUsageDescription - Recommended by some ad networks.
<key>GADApplicationIdentifier</key>
<string>YOUR_ADMOB_APP_ID</string>
<key>NSUserTrackingUsageDescription</key>
<string><App Name> needs your advertising identifier to provide personalised advertising experience tailored to you</string>
<key>NSCalendarsUsageDescription</key>
<string><App Name> needs your calendar to provide personalised advertising experience tailored to you</string>
info

Please note, if you have removed the Admob adapter, don't forget to remove the BDMNotsyAdapter as well using this guide.

Step 3. Initialize SDK

We recommended to call initialization method in AppDelegate -didFinishLaunchingWithOptions: function:

@UIApplicationMain
final class MyAppDelegate: UIResponder, UIApplicationDelegate, AppodealInitializationDelegate {
func application(
_ application: UIApplication, didFinishLaunchingWithOptions
launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil
) -> Bool {
Appodeal.setAutocache(false, types: .interstitial)
Appodeal.setLogLevel(.verbose)

// New optional delegate for initialization completion
Appodeal.setInitializationDelegate(self)
/// Any other pre-initialization
/// app specific logic

Appodeal.initialize(
withApiKey: "APP_KEY",
types: .interstitial
)

return true
}
func appodealSDKDidInitialize() {
// Appodeal SDK did complete initialization
}
}

adTypes is a parameter responsible for ad formats (ex. AppodealAdTypeRewardedVideo, AppodealAdTypeInterstitial). Initialize only those ad types you want to use in your app to avoid getting ad requests to unused ones.

consent is an object responsible for agreement to having user's personal data collected according to GDPR and CCPA laws. You can find more information here.

Make sure to replace APP_KEY with the actual app key. You can find it in the list of applications in your personal account.


You can use our demo app as a reference project.

Demo App


You can find detailed documentation here