The first step in getting started with iAds is to reference the iAds framework. Right click on the Frameworks folder and select "Add Existing Frameworks". Then select iAd.Framework and add it to the application. Take a look at the screenshot below to get a clear picture:
in Cocos2d 0.99.5(latest version) defaultly view controller inherits with the rootview controller.
just follow the below code.
now the ads is displaying in the bottom of the screen.
Final output like this:-
You can place ad anywhere but Apple recommends to choose either the top part of the view or the bottom part of the view. This placement will make sure that the ads are not interfering with the actual application. Also, note that these are just test ads which makes sure that the ads are running smoothly in your application. When the application is live in the app store then Apple will send relevant ads to your app.
The iAd network must be activated before submitted the app for approval. If the iAd network is not activated then ads will not be displayed. You can activate the iAd network for your particular app by logging into iTunes connect and managing the desired application. You do not need to activate the iAds network when only running test ads.
sometimes you will see the following error:
The operation couldn't be completed. banner view is visible but does not have content.
Do not worry to much about this error since this simply means that your application is having trouble communicating with the Apple iAd server. Most of the time the problem is on Apple's end and the only thing you can do is wait and try again at later time.