【问题标题】:Interstitial when game is over游戏结束时的插页式
【发布时间】:2014-05-29 13:41:49
【问题描述】:

我开发了一款带有 AdMob 横幅的 IOS Sprite Kit 游戏。我想在游戏开始时添加插页式广告,但不是。我有一个 GameOverScene 应该显示插页式广告的地方。不是游戏开始时,而是每次游戏结束时(加载 GameOverScene 时)

这是我的代码: ViewController.h

#import <UIKit/UIKit.h>
#import <SpriteKit/SpriteKit.h>
#import "GADBannerView.h"
#import "GADInterstitial.h"

@class GADBannerView, GADRequest;

@interface ViewController : UIViewController<GADBannerViewDelegate>
{
    GADBannerView *bannerView_;
    GADInterstitial *interstitial_;
}

@property (nonatomic, strong)GADBannerView *bannerView;
-(GADRequest *)createRequest;
-(void)createInterstitial;
@end

ViewController.m

- (void)viewDidLoad
{
    [super viewDidLoad];

    //Other code
    Interstitial
    interstitial_ = [[GADInterstitial alloc] init];
    interstitial_.delegate = self;
    interstitial_.adUnitID = MyInterstitialUnitID;
    [interstitial_ loadRequest:[GADRequest request]];

    //Other code

}

【问题讨论】:

    标签: ios admob sprite-kit interstitial


    【解决方案1】:

    检查此 googleads sample for interstitals
    您需要添加interstitialDidReceiveAd 方法来设置收到广告的标志,然后当您的游戏结束时,如果您发现该标志为真,请调用此[interstitial_ presentFromRootViewController:self];
    编辑:-
    另外要重新加载广告,可以添加interstitialDidDismissScreen方法调用[interstitial_ loadRequest:[GADRequest request]];

    【讨论】:

    • 如何做到这一点不止一次?
    • @JohnRiselvato 使用interstitialDidDismissScreen 方法并将[interstitial_ loadRequest:[GADRequest request]]; 添加到其中。这将重新加载一个可以以相同方式重复使用的新广告
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-07-05
    • 1970-01-01
    • 1970-01-01
    • 2021-07-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多