首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在ios应用中显示Interstitial?

如何在ios应用中显示Interstitial?
EN

Stack Overflow用户
提问于 2017-07-10 19:31:48
回答 1查看 78关注 0票数 1

每次我打开类别的间隙出现,我想让它出现一次

代码

代码语言:javascript
复制
//----------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");
}
EN

回答 1

Stack Overflow用户

发布于 2017-07-10 19:38:20

尝尝这个

代码语言:javascript
复制
static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
//call your method here
     [self createAndLoadInterstitial];
    });
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45010921

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档