Difference between revisions of "IOS Interstitial 4.1.0"

From AdLocus
Jump to: navigation, search
(Created page with "== 前言 == 插頁式版位將以曝光次數高分潤,是您提高收益的最好單元之一。 == 實作 == * @interface ViewController : UIViewController <ALInterstit...")
 
(啟用插頁式版位)
Line 9: Line 9:
 
在您想啟用插頁式版位的流程中中加入下列程式碼
 
在您想啟用插頁式版位的流程中中加入下列程式碼
 
<syntaxhighlight lang="objc">
 
<syntaxhighlight lang="objc">
     self.Interstitial = [[ALInterstitial alloc] init];
+
     self.interstitial = [[ALInterstitial alloc] init];
     [self.Interstitial setInterstitialAnimationType:AdLocusInterstitialAnimationTypeFadeIn];
+
     [self.interstitial setInterstitialAnimationType:AdLocusInterstitialAnimationTypeFadeIn];
     [self.Interstitial requestAdViewWithDelegate:self];
+
     [self.interstitial requestAdViewWithDelegate:self];
     [self.view addSubview:self.Interstitial];
+
     [self.view addSubview:self.interstitial];
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 18:09, 2 June 2016

前言

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

實作

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

啟用插頁式版位

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

    self.interstitial = [[ALInterstitial alloc] init];
    [self.interstitial setInterstitialAnimationType:AdLocusInterstitialAnimationTypeFadeIn];
    [self.interstitial requestAdViewWithDelegate:self];
    [self.view addSubview:self.interstitial];

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

透過實作 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);
}