Usually iAd is used as the advertisement portal for including ads on your iOS apps. But iAd is not supported in all countries and Google's admob has a wide range of network.
Here are some simple steps to follow in Xcode to include admob ads on your app.
1. Considering that you have already created your app, you need to add few lines of code and header files onto your controller.h file of the app.
2. Few App Frameworks are to be added to app. They are required to make the ad work.
3.You need to integrate the admob's SDK for iOS onto you app bundle. This is done by adding a New Group to the app
3. The code to be added to your main program
- (void)viewDidLoad
4. You need to be a registered member of Admob to get a valid ID for every ad you make, for every App. It has to be activated in the website to be executed in the app.
Once the above steps have been followed successfully, the ad will we displayed as preferred :)
Here are some simple steps to follow in Xcode to include admob ads on your app.
1. Considering that you have already created your app, you need to add few lines of code and header files onto your controller.h file of the app.
- #import <UIKit/UIKit.h>
#import "GADBannerView.h"@interface ViewController : UIViewController{GADBannerView *bannerView_;}@end
2. Few App Frameworks are to be added to app. They are required to make the ad work.
- Under Build Phases>Link Binary with Libraries>add the following frameworks.
- AudioToolbox.Framework
- CodeGraphics.Framework
- SystemConfigurateion.Framework
- MessageUI.Framework
3.You need to integrate the admob's SDK for iOS onto you app bundle. This is done by adding a New Group to the app
- Right click your app name > New Group > name it 'Admob'.
- Click File>Add Files (with the group name highlighted) > Navigate to location of SDK.
- Now the SDK files are linked onto your app.
3. The code to be added to your main program
- (void)viewDidLoad
{
[super viewDidLoad];
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
// Specify the ad's "unit identifier". This is your AdMob Publisher ID.
bannerView_.adUnitID = @"YOUR UNIQUE 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_];
// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:[GADRequest request]];
// Do any additional setup after loading the view, typically from a nib.
}
4. You need to be a registered member of Admob to get a valid ID for every ad you make, for every App. It has to be activated in the website to be executed in the app.
Once the above steps have been followed successfully, the ad will we displayed as preferred :)
No comments:
Post a Comment