Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AdMob not showing ads in iOS simulator

Tags:

ios

iphone

admob

I am trying to use AdMob on an app (built for iOS 4.0)

I've added the sample code available in the tutorial http://code.google.com/mobile/ads/docs/ios/fundamentals.html which is the following (I've changed the adUnitID):

// Create a view of the standard size at the bottom of the screen.
bannerView_ = [[GADBannerView alloc]
               initWithFrame:CGRectMake(0.0,
                                        self.view.frame.size.height -
                                        GAD_SIZE_320x50.height,
                                        GAD_SIZE_320x50.width,
                                        GAD_SIZE_320x50.height)];

// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = @"XYZ";

// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
[self.view bringSubviewToFront:bannerView_];

GADRequest * request = [GADRequest request];

// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:request];

Doing this nothing happens, no ad is shown and the number of requests in my AdMob app page increase erratically (i.e.: I can't seem to notice a pattern), but the most important is no ad is shown.

If I add the following code:

GADRequest * request = [GADRequest request];

request.testDevices = [NSArray arrayWithObjects:
                       GAD_SIMULATOR_ID,                               // Simulator
                       nil];

// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:request];

I get the "Success! You are now ready to travel through the App Galaxy" default banner, but only this one.

So my questions are:

  • Aren't the sample code enough to show ads? Why I never see an ad with the sample code?
  • As far as I understood, requests mean the number of times my app asked for an ad to be shown. I also understood that not every request is replied with an ad (otherwise the fill rate would be 100%), but still, I NEVER saw an ad, what am I doing wrong?

Thanks in advance.

like image 778
Jay_Santos Avatar asked May 11 '11 16:05

Jay_Santos


1 Answers

  GADBannerView *bannerView = [[GADBannerView alloc]
              initWithFrame:CGRectMake(0.0,
                                       self.view.frame.size.height -
                                       GAD_SIZE_320x50.height,
                                       GAD_SIZE_320x50.width,
                                       GAD_SIZE_320x50.height)];//Set Position

  bannerView.adUnitID = @"12331255421245";//Call your id

// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.


bannerView.rootViewController = self;

[self.view addSubview:bannerView];//Your attempt to add bannerview


// Initiate a generic request to load it with an ad.

[bannerView loadRequest:[GADRequest request]];
like image 177
venki Avatar answered Oct 23 '22 13:10

venki