Admob 插页式 Cocos2d Objective C

Admob Interstitial Cocos2d Objective C

我正在 google 上搜索,但我只在 Cocos2d 中找到了将 AdMob 横幅视图集成到我的应用程序中的方法。现在我需要放置全屏 AdMob 插页式广告,但我找不到这样做的方法:。请帮助我,我该怎么做?

我不确定我需要什么源代码post...我想在应用程序启动时和游戏结束时显示插页式广告。

我已经试过了this

但它给了我一些错误。

在AppDelegate.h中添加GADInterstitialDelegate

@interface AppController : NSObject <UIApplicationDelegate, CCDirectorDelegate, GADInterstitialDelegate>
{
}
-(void)showAdmobFullScreenAds;
@end

#define App ((AppController *)[[UIApplication sharedApplication] delegate])

在AppDelegate.m

-(void)showAdmobFullScreenAds
{
    GADInterstitial  *interstitial_ = [[GADInterstitial alloc] init];
    interstitial_.adUnitID = @"ca-app-pub-YOUR_ID";
    interstitial_.delegate = self;
    [interstitial_ loadRequest:[GADRequest request]];

}

- (void)interstitialDidReceiveAd:(GADInterstitial *)interstitial
{
    [interstitial presentFromRootViewController:[CCDirector sharedDirector]];
}

// 在 GameOver class 中,添加 #import "AppDelegate.h" 然后使用下面的函数

   [App showAdmobFullScreenAds];