iOS SDK Configuration


Mobile Ads Settings

Before starting, first you must configure the SDK via EMASettings.shared or via EMASettings sharedInstance if you are using Objective-C.

Required Parameters

Important Note: You may use either EMADelegate class by extending App Delegate for the lifecycle of app or you should implement following code blocks in the App Delegate class for the better ad performance:

func applicationDidBecomeActive(_ application: UIApplication) {
func applicationDidEnterBackground(_ application: UIApplication) {

Important Note: You must set the initial view controller of your app by the following code:

self: Initial viewController instance.

EMASettings.shared.rootViewController = self

If you are not using a window property, you should pass your app's rootViewController reference, which is the initial view controller of your main storyboard.

If you have the user's consent on displaying non-personalized ads, you may set isAdsNonPersonalized to true or to YES if you are using Objective-C.

Optional Parameters

Some properties of EMASettings are for testing and debugging purposes.

The optional parameters are:

  • isAdsDisabled: The default value is false. Set this value to true if you don't want your users to see ads. E.g. you may not want your premium users to see ads.
  • isUserLoggedInWithFB: Default value is false. Used for user targeting. Set this value to true if the current user is logged in via Facebook.
  • logLevel: The default value is LogLevel.none. Set this value to LogLevel.all to print out all debug messages. Other values are: LogLevel.normal, LogLevel.warning and LogLevel.error.
  • testingType: The default value is AdTestingType.none. This may be used to test the DFP Banner Ads, DFP Interstitial Ads, AdMob Banner Ads, AdMob Interstitial Ads or IMA Preroll Ads. Please don't forget to remove this setting before submitting your app to the App Store!
  • testDevices: If you'd like to test the ads via your device's testing id then add the value to this property. Please don't forget to remove this setting before submitting your app to the App Store!

Note: If a user is using the app with the VoiceOver enabled, then all ads will be disabled. To learn more about VoiceOver, please visit Apple's Accessibility page.

Initializing the SDK

After configuring the SDK with at least the required parameters, you must call initAd method of EMAManager.shared, which initializes the SDK and sends a notification of type Notification.Name.AdLib.AdsReadyForDisplayNotification once the initialization is complete. This only needs to be done once, ideally at the application launch. Please also note that EMAManager.shared.isAdsReadyForDisplay is set to true once the initialization process is completed.

You can also add AppViewDelegates through EMAManager.shared.appViewDelegates property to listen sendAppView events with appViewCompleted and appViewFailed. Note that sendAppView may get called multiple times in one session.

self(Application Delegate instance): Application delegate instance.

appAdIdentifier: Your app idenfier which will be provided by us.

adAppVersion(Optional): ad version for the related app default value is "1"

testMode(Optional): to enable debugging logs and test ads.

NotificationCenter.default.addObserver(self, selector: #selector(adsReadyForDisplayNotification), name: Notification.Name.AdLib.AdsReadyForDisplayNotification, object: nil)
EMAManager.shared.initAd(self, "your_app_identifier", "1", true)