Starting from iPhone OS4, you can add an advertisement banner to your iPhone Application using the iAd framework. I found a great article talking about adding iAd to the iPhone app. Here is an example of a empty view based application with iAd.
1. Open Xcode and create a new View-based Application (iAdProject)
2. Add iAd.framework to the project
3. Modify the iAdProjectViewController.h
//
// iAdProjectViewController.h
// iAdProject
//
// Created by ykyuen on 21/07/2010.
//
#import <UIKit/UIKit.h>
#import <iAd/iAd.h>
@interface iAdProjectViewController : UIViewController <ADBannerViewDelegate>{
ADBannerView *adBannerView;
}
@property(nonatomic, retain) ADBannerView *adBannerView;
@end
4. Modify the iAdProjectViewController.m
//
// iAdProjectViewController.m
// iAdProject
//
// Created by ykyuen on 21/07/2010.
//
#import "iAdProjectViewController.h"
@implementation iAdProjectViewController
@synthesize adBannerView;
- (void)viewDidLoad {
[super viewDidLoad];
adBannerView = [[ADBannerView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 50.0)];
adBannerView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];
adBannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
[adBannerView setHidden:YES];
adBannerView.delegate = self;
[self.view addSubview:adBannerView];
}
- (void)bannerViewDidLoadAd:(ADBannerView *)banner {
[banner setHidden:NO];
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
[banner setHidden:YES];
}
- (void)dealloc {
[adBannerView release];
[super dealloc];
}
@end
There are much more information about iAd in the reference below.
Done =)
Reference: How to Add iAd Banner in iPhone App


brilliant
LikeLike
How much money do you get if someone with your app taps on the ad.
LikeLike
I don’t know that too since there is no solid information even from Apple.
i think you can refer to the following post to get a rough idea.
How much revenue can I get from iAd?
LikeLike
Thanks for the link.
In your post: iPhone – Configuring the AVAudioSession and Output Audio to iPhone Speaker, you commented on using
1. create a switching function in the appDelegate which take a bool as input parameter and change the audio route.
2. then in your view, add a button and implement the click action which called the appDelegate to change the route.
i am not sure if it works or not since i dun know if the route can be changed on the fly.
can you explain this in a little more detail as i don’t know if i’ve done it right.
Thanks
LikeLike
I have read the post configuring the AVAudioSession and Output Audio 2 iPhone Speaker, and i think, just like someone Somewhere, that comment needs a little more detail. I am really stuck on doing this 2.
LikeLike
hi bob, please post the comment in the relevant post.
by the way, could you post your code and let me see what’s the problem is?
LikeLike
…sure thing…
LikeLike
I’ve been poking around a bit… this is easily the best iAd tutorial I’ve found. Thank you.
LikeLike
good to know that the post could help you =D
LikeLike