AzerionAds SDK has been designed to give developers options for showing Ads from ImproveDigital
and AdMob
. Developer can choose the priorities between ad networks and set the ad unit ids from configuration file.
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate AzerionAds into your Xcode project using CocoaPods, specify it in your Podfile:
pod 'AzerionAds'
To build AzerionAds on the simulator, please add this in your Podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
end
Drag and drop the AzerionAds.framework
and AzerionAdsResources.bundle
file in your xcode project. Add AzerionAds.framework
as a Embeded framework. If you want to show AdMob ads then you need to integrate AdMob frameworks also. You can do that either by adding the frameworks manually or by using cocoapods. You will found complete instructions of adding AdMob here:
AdMob integration in xcode project
App developer should get the user consent for EU ePrivacy Directive and the General Data Protection Regulation (GDPR).
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
AZASettings *settings = [[AZASettings alloc] init];
settings.withUserConsent = true;
settings.isCOPPACompliant = true;
settings.gdprConsentString = @"GdprConsentString";
[AzerionAds initializeWithSettings:settings withInitializationStatusHandler:^(AZAInitializtionStatus * _Nonnull status) {
}];
return YES;
}
Add an UIView as a subview and assign AZABannerView
as class of that view from Identity Inspector. Add outlet for the banner view
@property (retain, nonatomic) IBOutlet AZABannerView *bannerView;
self.bannerView.adUnitId = @"YOUR_BANNER_AD_UNIT_ID_HERE"
self.bannerView.rootViewController = self;
self.bannerView.delegate = self;
self.bannerView = [[AZABannerView alloc] initWithAdSize:BannerAdSize.FullBanner origin:CGPointMake(0, 0)];
self.bannerView.adUnitId = @"YOUR_BANNER_AD_UNIT_ID_HERE"
self.bannerView.rootViewController = self;
self.bannerView.delegate = self;
- Load Banner Ad
bannerAdView.loadAd();
- Destroy : when you longer needed the BannerAdView it's better to destroy it for avoding memory leak.
bannerAdView.destroy();
Implement AZABannerViewDelegate delegates
- (void)bannerViewDidReceiveAd:(AZABannerView *)bannerView {
}
- (void)bannerView:(AZABannerView *)bannerView didFailToReceiveAdWithError:(AZAAdError *)error {
}
- (void)bannerViewDidRecordImpression:(AZABannerView *)bannerView {
}
- (void)bannerViewDidLeftApplication:(AZABannerView *)bannerView {
}
- (void)didOpenedBannerView:(AZABannerView *)bannerView {
}
Load Banner Ad
[self.bannerView loadAd];
self.interstitialAd = [[AZAInterstitialAd alloc] initWithVideoAdUnitId:@"YOUR_INTERSTITIAL_VIDEO_AD_UNIT_ID_HERE" withStaticAdUnitId:@"YOUR_INTERSTITIAL_STATIC_AD_UNIT_ID_HERE"];
self.interstitialAd.delegate = self;
Implement AZAInterstitialAdDelegate delegates
-(void)onLoadAd:(AZAInterstitialAd *)ad {
}
-(void)onFailedToLoadAd:(AZAInterstitialAd *)ad withError:(AZAAdError *)error {
}
-(void)onClickedAd:(AZAInterstitialAd *)ad {
}
-(void)onDisplayedAd:(AZAInterstitialAd *)ad {
}
-(void)onFailedToDisplayAd:(AZAInterstitialAd *)ad withError:(AZAAdError *)error {
}
-(void)onAdImpression:(AZAInterstitialAd *)ad {
}
-(void)onClosedAd:(AZAInterstitialAd *)ad {
}
Load interstitial ad
[self.interstitialAd loadAd];
Show interstitial ad
[self.interstitialAd presentFromRootViewController:viewController];
self.rewardedAd = [[AZARewardedAd alloc] initWithAdUnitId:placementId delegate:delegate];
self.rewardedAd.delegate = self;
Implement AZARewardedAdDelegate delegates
-(void)onLoadRewardedAd:(AZARewardedAd *)ad {
}
-(void)onFailedToLoadRewardedAd:(AZARewardedAd *)ad withError:(AZAAdError *)error {
}
-(void)onDisplayedRewardedAd:(AZARewardedAd *)ad {
}
-(void)onFailedToDisplayRewardedAd:(AZARewardedAd *)ad withError:(AZAAdError *)error {
}
-(void)onDismissRewardedAd:(AZARewardedAd *)ad {
}
-(void)onRewardEarned:(AZARewardedAd *)ad rewardItem:(AZARewardItem *)rewardItem {
}
Load rewarded ad
[self.rewardedAd loadAd];
Show rewarded ad
[self.rewardedAd presentFromRootViewController:viewController];