I would like some help with integrating interstitial ads from Applovin using Swift. Currently, I have managed to successfully integrate the SDK and initialize it using ALSdk.initializeSdk()
. I have a folder in my project directory called Applovin
which contains: headers
folder (with all the .h files inside) and libApplovinSdk.a
.
I have a BridgingHeader.h
file in which I am importing the relevant frameworks
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <Chartboost/Chartboost.h>
#import <Chartboost/CBNewsfeed.h>
#import <CommonCrypto/CommonDigest.h>
#import <AdSupport/AdSupport.h>
#import <AVFoundation/AVFoundation.h>
#import<CoreTelephony/CTCallCenter.h>
#import<CoreTelephony/CTCall.h>
#import<CoreTelephony/CTCarrier.h>
#import<CoreTelephony/CTTelephonyNetworkInfo.h>
#import <CoreGraphics/CoreGraphics.h>
#import <CoreMedia/CoreMedia.h>
#import <MediaPlayer/MediaPlayer.h>
#import <SystemConfiguration/SystemConfiguration.h>
// Core SDK
#import "ALErrorCodes.h"
#import "ALSdk.h"
#import "ALSdkSettings.h"
#import "ALTargetingData.h"
#import "ALPostbackService.h"
#import "ALPostbackDelegate.h"
// Standard Ads
#import "ALAd.h"
#import "ALAdDisplayDelegate.h"
#import "ALAdLoadDelegate.h"
#import "ALAdRewardDelegate.h"
#import "ALAdService.h"
#import "ALAdSize.h"
#import "ALAdType.h"
#import "ALAdUpdateDelegate.h"
#import "ALAdVideoPlaybackDelegate.h"
#import "ALAdView.h"
#import "ALIncentivizedInterstitialAd.h"
#import "ALInterstitialAd.h"
// Native Ads
#import "ALNativeAd.h"
#import "ALNativeAdService.h"
#import "ALNativeAdPrecacheDelegate.h"
#import "ALNativeAdLoadDelegate.h"
In my AppDelegate
i have the following methods, what do I need to put inside these methods?
func adService(adService: ALAdService, didLoadAd ad: ALAd) {
}
func adService(adService: ALAdService, didFailToLoadAdWithError code: Int32) {
}
I am attempting to show ads using the following code but ALInterstitialAd.isReadyForDisplay()
is always false, I am probably missing something very obvious but I am not sure what it is, any help is appreciated, thanks!
if ALInterstitialAd.isReadyForDisplay() == true {
ALInterstitialAd.show()
} else {
println("No Applovin Ad available to show")
}
You likely need to enable "Test Mode" for your app in the AppLovin dashboard in order to force test ads to serve for your area. Please send any questions to [email protected] for further assistance.