Sample code for admob on iPhone does not show ad

My goal is to create an AdMob banner in my iPhone app. As a starting point, all I want to do is successfully execute the sample code provided by Google. I signed up for an adMob account and got the publisher ID. I am uploading a sample code provided by Google at http://code.google.com/mobile/ads/docs/ios/fundamentals.html .

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

#define MY_BANNER_UNIT_ID @"xxxxxxxxxxxxx3dc2"

The code works without errors or warnings. I do not see messages on the console. However, when I run the simulator (4.2), I get only a gray screen without an ad, as shown in the screenshot of Google. The documentation advises you to wait 2 minutes for the first time, but I waited longer than without joy.

Any clues would be greatly appreciated.

Thank,

Dessie.

+3
source share
2 answers

So, after lunch, I seem to have solved my problem. I just wanted to post my decision if someone was stuck at the same point.

, . , NSLog AdBannerDidReceiveAd , . , , , , , . , :

[bannerView_ loadRequest:[GADRequest request]];

:

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

: , Tech Tech Mark:

http://markstechstuff.blogspot.com/2011/04/gadrequest-test-mode-istesting.html

, ,

+4

viewDidLoad:

-(void)addAdmob{
    bannerView = [[GADBannerView alloc]initWithAdSize:kGADAdSizeLargeBanner];
    bannerView.adUnitID = @"ca-app-pub-2256523967514###/##########";
    bannerView.rootViewController = self;
    [self.view addSubview:bannerView];
    [bannerView loadRequest: [GADRequest request]];
}
0

All Articles