Case Study: AdMob Integration in iPhone & iPad application (in native xcode project)


This Case study talks about how a iOS developer can integrate AdMob SDK into native xCode project, this is a very basic case study and very useful for some one who is integrating AdMob SDK for first time.
  • Problem/Issue: 

We want to display Advertisement on each screen of iphone application. Other advertisement platforms are also available, We want to use AdMob for that.

  • Solution/Steps flow by you: 

First go to site, we need to register in this site for AdMob. After login, goto Sites & Apps –> Add site/App –> Select a site or app type –> Select iPhone App

Next we need to full fill details.

Now you can download the AbMob SDK, it is required for publishing Ads and drag drop into the Xcode project.

We need to add framework in project, so select the framework -> add New Framework -> Select AudioTollbox.framework, MediaPlayer.framework,MessageUI.framework and SystemConfiguration.framework add in the Framework folder.

Import GADBannerView.h file in your project’s .pch file. #import “GADBannerView.h”

Create object of GADBannerview in your .h file. like. GADBannerView *AbMob;

Now in your .m file alloc that object and add to your view.
Code snippest for that is attached below.

  • Reference link: Click this
  • Sample code which you have written:

/* write this code in viewdidload method


// Use predefined GADAdSize constants to define the GADBannerView. UIInterfaceOrientation ori=(UIInterfaceOrientation)[[UIApplication sharedApplication] statusBarOrientation]; if(ori == UIInterfaceOrientationLandscapeLeft || ori == UIInterfaceOrientationLandscapeRight) AbMob = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerLandscape origin:origin]; else AbMob = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait origin:origin];


AbMob.adUnitID = Ad_MobID; AbMob.rootViewController = self;


if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) [self.view insertSubview:AbMob belowSubview:kategoryview]; else [self.view addSubview:AbMob]; GADRequest *r = [[GADRequest alloc] init]; r.testing = YES; [AbMob loadRequest:r];


add this line in dealloc method AbMob.delegate = nil; [AbMob release];


Ad_MobID is publisher id which u get from your account on For that go to sites&APPs,click on your app,click on manage app. You will see publisher ID near by your app name. */

  • Screen shot(s)

If you are planning to monetize your app through advertisement revenue contact Space-O can help you integrate several Advt. network like AdMob, iAds, Chartboost, MoPub etc.  We can provide you services to add Advt. networking in your existing iOS application also we can integrate the same in your new app.

SEE Also: Steps to integrate Open Graph Facebook API into an iPhone & Android Application

This case study was documented and contributed by: Shraddha Hattimare, Senior iPhone App Developer at Space-O Technologies.


Have an App Idea?

Get your free consultation now

Get Your Free Quote