google admob ios:请求错误:没有要显示的广告

google admob ios:请求错误:没有要显示的广告,ios,admob,interstitial,Ios,Admob,Interstitial,我找到了一个相关的线程,但它不能解决我的问题 我正在尝试使用google代码中的最新示例项目创建一个插入式广告: 我已将ksampleadunid更改为我的广告id 昨天,当我点击加载间隙时,我得到了请求错误:没有要显示的广告。我必须点击4-5次,它才能工作 今天,我使用的是相同的代码,没有改变,但无论我点击多少次加载Interstitual,我都会遇到上面提到的错误 这里有什么帮助吗?我的实现如下-我希望它有帮助: @interface ViewController () <GADInt

我找到了一个相关的线程,但它不能解决我的问题

我正在尝试使用google代码中的最新示例项目创建一个插入式广告:

我已将
ksampleadunid
更改为我的广告id

昨天,当我点击加载间隙时,我得到了请求错误:没有要显示的广告。我必须点击4-5次,它才能工作

今天,我使用的是相同的代码,没有改变,但无论我点击多少次加载Interstitual,我都会遇到上面提到的错误


这里有什么帮助吗?

我的实现如下-我希望它有帮助:

@interface ViewController () <GADInterstitialDelegate>
@property (strong, nonatomic) GADInterstitial *interstitial;   
@end   


@implementation ViewController

#define MY_INTERSTITIAL_UNIT_ID @"...."

- (void)preLoadInterstitial {
    //Call this method as soon as you can - loadRequest will run in the background and your interstitial will be ready when you need to show it
    GADRequest *request = [GADRequest request];
    self.interstitial = [[GADInterstitial alloc] init];
    self.interstitial.delegate = self;
    self.interstitial.adUnitID = MY_INTERSTITIAL_UNIT_ID;
    [self.interstitial loadRequest:request];
 }

- (void)interstitialDidDismissScreen:(GADInterstitial *)ad
{
    //An interstitial object can only be used once - so it's useful to automatically load a new one when the current one is dismissed
    [self preLoadInterstitial];
}

- (void)interstitial:(GADInterstitial *)ad didFailToReceiveAdWithError:(GADRequestError *)error
{
    //If an error occurs and the interstitial is not received you might want to retry automatically after a certain interval
    [NSTimer scheduledTimerWithTimeInterval:3.0f target:self selector:@selector(preLoadInterstitial) userInfo:nil repeats:NO];
}

- (void) showInterstitial
{
    //Call this method when you want to show the interstitial - the method should double check that the interstitial has not been used before trying to present it
    if (!self.interstitial.hasBeenUsed) [self.interstitial presentFromRootViewController:self];
}

@end
@界面视图控制器()
@性质(强,非原子)GaD填隙*填隙;
@结束
@实现视图控制器
#定义我的中间单位ID…“
-(空隙)间隙前{
//尽可能快地调用此方法-loadRequest将在后台运行,并且在需要显示时,您的Interstitual将准备就绪
GADRequest*请求=[GADRequest请求];
self.interstitual=[[gadistitual alloc]init];
self.interstitial.delegate=self;
self.interstitial.adUnitID=我的interstitial单位ID;
[自填隙加载请求:请求];
}
-(无效)间质IDDISMISSCREEN:(GADInternitical*)ad
{
//间隙对象只能使用一次,因此在当前对象被取消时自动加载一个新对象非常有用
[自体间质];
}
-(void)interstival:(gadInterstival*)ad未能接收到带有错误的数据:(GADRequestError*)错误
{
//如果发生错误且未收到填隙,您可能希望在一定间隔后自动重试
[NSTimer scheduledTimerWithTimeInterval:3.0f目标:自选择器:@selector(预插入)用户信息:无重复:否];
}
-(空)间隙的
{
//当您想要显示填隙文件时调用此方法-该方法应在尝试显示填隙文件之前仔细检查是否未使用该文件
如果使用了(!self.interstitial.hasbeen)[self.interstitial presentFromRootViewController:self];
}
@结束
感谢
如果(!self.interstitual.hasBeenUsed)