0

Add iAD on your app

by Deepak Dhakal 29. February 2012 11:39

Here is a step by step as I did it.

1. You need to enable iAd Network in your ituneconnect account :-
a) Make sure your iAd Contract is in effect.
b) Add a new app or if you are adding iAd to existing app, click on add version.
Then on that version, Enable the iAd for that app.
c) You may need to wait a while, then when you go to your iTunesconnect home page, you will see a new module "iAd Network" on the right column. Click that and follow the instructions.

2. Then just go to your XCode, add iAds thingies:-
a) Add Existing Framework - > iAd.framework.
b) In your .h add #import <iAd/iAd.h>
c) In your .h, add <ADBannerViewDelegate>
d) Create IBOutlet for the ADBannerView, drop the iAd object in your IB and
link it to the IBOutlet
e) Put all of the 4 delegates in your code. You need to show the ADBanner when an ad is called by the delegate. And when the delegate says there are no ads or error (due to no internet connection), you need to hide the AD.

This is my code:

Code:
- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave {
	return YES;
	
}


- (void)bannerViewDidLoadAd:(ADBannerView *)banner {
	AdIsShowing = YES;
	if (myAD.center.y>500) {
		[self moveAdIn]; // this is a custom method to show ad and move things around.
	}
}

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
	AdIsShowing = NO;
	if (myAD.center.y<460) {
	[self moveAdOut]; // this is a custom method to show ad and move things around.
	}
	
}


-(void)bannerViewActionDidFinish:(ADBannerView *)banner
{
}

Done. When you run, you should see the iAd Test Advertisment.

 

There is youtube video that explains in detail as well.

http://www.youtube.com/watch?v=cM9DqJmj45g

Tags: , ,

iPhone

0

Stock Web site

by Deepak Dhakal 19. February 2012 09:29

Tags:

Stock

0

Two namespaces and similar class name inside in C#

by Deepak Dhakal 7. February 2012 13:04
I have namaspace for two version of the same class, V1 and v2
namespace Hello.ThisIsAnExample.Noway.StillAnExample.V1
{
Class A
{
public void Nothing()
{
}
}
}

namespace Hello.ThisIsAnExample.Noway.StillAnExample.V2
{
Class A
{
public void Nothing()
{
}
}
}


Then in the Main class, use like this

using V1=Hello.ThisIsAnExample.Noway.StillAnExample.V1
using V2=Hello.ThisIsAnExample.Noway.StillAnExample.V2

Pubic Main()
{
 V1.A.Nothing(); // Calls V1
 V2.A.Nothing(); // Calls V2
}



Sweet !!! is not it ???

Tags:

.Net

Powered by BlogEngine.NET 1.5.0.7
Original Design by Laptop Geek, Adapted by onesoft