The code sample for admob on iPhone does not display an ad


My goal is to create an AdMob banner in my iPhone app. As a starting point, all I want to do is sucessfully run the example code provided by Google. I registered for an adMob account and got a publisher id. I download the sample code provided by Google at

I added the following to the top of my BannerExampleViewController.m:

#define MY_BANNER_UNIT_ID @"xxxxxxxxxxxxx3dc2"

The code runs without errors or warnings. I don't see any messages on the console. However, when I run in the Simulator (4.2) I get just a grey screen without the ad as shown in Google's screen shot. The documentation advises that you have to wait 2 minutes the first time but I have waited longer than that and no joy.

Any hints would be much appreciated.



So after an afternoon of goofing around, I seem to have solved my problem. I just wanted to post my solution in case anyone got stuck at the same point.

When I ran the sample code as it is issued, I got a blank view with no error messages and no ad. I probably should have put some NSLog messages in the AdBannerDidReceiveAd method or the error method and I would have gotten an answer sooner. Anyway, the critical thing I did that got me rolling was to put my ad request in testing mode. I did this by replacing the line:

[bannerView_ loadRequest:[GADRequest request]];


GADRequest *r = [[GADRequest alloc] init];
r.testing = YES;
[bannerView_ loadRequest:r];

Full disclosure: I didn't just think of this, I found it on Mark's tech blog at:

Thanks Mark,