Ad is used to display ads, which is served by the apple server. iAd helps the user in earning revenue from an iOS application.
iAd Integration – Steps Involved
- Step 1. We need to create a simple view-based application.
- Step 2. We need to select your project file, then select targets and then add iAd.framework in choose frameworks.
- Step 3. We need to Update ViewController.h as follows −
@interface ViewController : UIViewController<ADBannerViewDelegate>
- Step 4. We need to update ViewController.m as stated below−
@interface ViewController ()
bannerView = [[ADBannerView alloc]initWithFrame:
CGRectMake(0, 0, 320, 50)];
// Optional to set background color to clear color
[bannerView setBackgroundColor:[UIColor clearColor]];
[self.view addSubview: bannerView];
// Dispose of any resources that can be recreated.
#pragma mark - AdViewDelegates
NSLog(@"Ad will load");
NSLog(@"Ad did finish");
When we execute the application, we’ll get the below result −