GoogleMobileAdsSdkiOS-6.12.0 - Error Domain=com.google.ads Code=1 "Request Error: No ad to show."

586 views
Skip to first unread message

Sergiu Jomiru

unread,
Oct 30, 2014, 9:18:30 AM10/30/14
to google-adm...@googlegroups.com
Hello, i have a problem, when trying to use latest sdk in my ios app, for GADInterstitial i am getting the following error:
"
Error Domain=com.google.ads Code=1 "Request Error: No ad to show." UserInfo=0x175667c40 {NSLocalizedDescription=Request Error: No ad to show., NSLocalizedFailureReason=Request Error: No ad to show.}"
i have added my 
interstitial_.adUnitID and so on.
could any1 from support team help me to figure out what's the problem please? thank you in advance.
here are my sources also:

//  AdMobInterstatial.h


#import <Foundation/Foundation.h>

#import "GADInterstitial.h"

#import "GADInterstitialDelegate.h"

#import "SampleConstants.h"


@interface AdMobInterstatial : NSObject <GADInterstitialDelegate> {

    GADInterstitial *interstitial_;

    GADRequest *globalReq;

}


- (GADRequest *)request;

- (void)addInterstitial;


@end



//  AdMobInterstatial.m

#define kAdMobInterstatialID @"ca-app-pub-1803577390352751/5140441xxx"

#import "AdMobInterstatial.h"


@implementation AdMobInterstatial


- (void)interstitial:(GADInterstitial *)interstitial didFailToReceiveAdWithError:(GADRequestError *)error {

    NSLog(@"err%@", error);

    UIAlertView *alert = [[UIAlertView alloc]

                          initWithTitle:@"GADRequestError"

                          message:[error localizedDescription]

                          delegate:nil cancelButtonTitle:@"Drat"

                          otherButtonTitles:nil] ;

    [alert show];

}


- (void)interstitialDidReceiveAd:(GADInterstitial *)interstitial {

    UIViewController *root = [[[[UIApplication sharedApplication] delegate] window] rootViewController];;

    while (root.presentedViewController)

        root = root.presentedViewController;

    if (!interstitial.hasBeenUsed)

        [interstitial presentFromRootViewController:root];

}


-(void)addInterstitial{

    interstitial_ = [[GADInterstitial alloc] init] ;

    interstitial_.delegate = self;

    interstitial_.adUnitID = kAdMobInterstatialID;

    [interstitial_ loadRequest:globalReq];

    

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW,(int64_t)(3 * NSEC_PER_SEC)),

                   dispatch_get_main_queue(), ^{

                       globalReq = [self request];

                   });

}



- (GADRequest *)request {

    GADRequest *request = [GADRequest request];

    request.testDevices = @[GAD_SIMULATOR_ID];

    return request;

}



@end

Eric Leichtenschlag

unread,
Oct 31, 2014, 5:07:01 PM10/31/14
to google-adm...@googlegroups.com
Hello,

It could be just cause of no inventory.

It looks like you're initializing globalReq after you actually load the ad, which would mean a nil ad request. What happens if you just call [interstitial_ loadRequest:[self request]; ?

Thanks,
Eric
Reply all
Reply to author
Forward
0 new messages