2017-07-10 3 views
0

Iオープンカテゴリ間質が、私はそれがiosアプリでインタースティシャルを一度表示するにはどうすればよいですか?

一度コード

//----------Interstitial Initialization-------------// 
-(void)createAndLoadInterstitial 
{ 
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; 

    _interstitial = [[GADInterstitial alloc] initWithAdUnitID:appDelegate.InterstitialAdUnitID]; 
    _interstitial.delegate = self; 
    [_interstitial loadRequest:[GADRequest request]]; 
} 
- (void)interstitialDidReceiveAd:(GADInterstitial *)interstitial 
{ 
    [_interstitial presentFromRootViewController:self]; 
} 
- (void)interstitial:(GADInterstitial *)interstitial didFailToReceiveAdWithError:(GADRequestError *)error 
{ 
    NSLog(@"interstitialDidFailToReceiveAdWithError: %@", [error localizedDescription]); 
} 
- (void)interstitialDidDismissScreen:(GADInterstitial *)interstitial 
{ 
    NSLog(@"interstitialDidDismissScreen"); 
} 
+0

。 GADInterstitialは1回限りの使用オブジェクトなので、 – KKRocks

答えて

0

を表示させたい現れるたびに試してみてください、あなたがのviewDidLoadで初期化する必要があり、この

static dispatch_once_t onceToken; 
    dispatch_once(&onceToken, ^{ 
//call your method here 
    [self createAndLoadInterstitial]; 
    }); 
+0

それは私にエラー – heythem500

+0

どのようなエラーが分かりますか?チェックを編集 – karthikeyan

+0

私はコードの前にこれを置く必要がありますアマチュアですか?右 – heythem500

関連する問題