IOS Interstitial 4.1.0

From AdLocus
Jump to: navigation, search

前言

插頁式版位將以曝光次數高分潤,是您提高收益的最好單元之一。

實作

  • @interface ViewController : UIViewController <ALInterstitialDelegate>
  • @property (nonatomic, strong) ALInterstitial *Interstitial;

啟用插頁式版位

在您想啟用插頁式版位的流程中中加入下列程式碼

    self.interstitial = [[ALInterstitial alloc] init];
    self.interstitial.key = @"請填入 APP KEY";
    self.interstitial.targeting = targeting; //(選擇性) 請參考 ALTargeting 設定
    [self.interstitial setInterstitialAnimationType:AdLocusInterstitialAnimationTypeFadeIn];
    [self.interstitial requestWithDelegate:self];
    [self.view addSubview:self.interstitial]; //放到 interstitialDidReceiveAd: ,當廣告載入後可立即展示。

若您需要監聽廣告互動結果

透過實作 ALInterstitialDelegate 監測廣告運行結果

  • interstitialDidReceiveAd
  • interstitialDidFailToReceiveAd
- (void)interstitialDidReceiveAd:(ALInterstitial *)interstitial
{
    NSLog(@"Receive AdLocus interstitial Ad.");
}
 
- (void)interstitialDidFailToReceiveAd:(ALInterstitial *)interstitial error:(AdLocusError *)error
{
    NSLog(@"Failed to receive AdLocus interstitial Ad : %@", error);
}