PowenKo, Unity3D Tutorial 160, AdMob on Unity3D and iOS

October 18, 2011   ·   0 Comments

Do you want code snippets, or something you can drop in and forget about? The later will require a PostProcessBuildScript because there’s code changes to be made.

The important part is:

AdMobView *ad = [[AdMobView requestAdWithDelegate: selfController] retain];
ad.frame = CGRectMake(0, 0, 320, 48);
[_window addSubview:ad];
_timer = [NSTimer scheduledTimerWithTimeInterval:(15.0) target: ad selector:@selector(requestFreshAd) userInfo:nil repeats:YES];

I retained the view because I don’t want it going away if the ad server doesn’t return an ad (which apparently it might do) but it’s probably not necessary. And obviously, change the timer interval to whatever works for you.

Oh, and of course, add the AdMob libraries and header files (and the CoreGraphics and CoreLocation frameworks) to the project in XCode.

You also need to define and set selfController.

Lots of little details. I’ll write up the little details later. Or maybe making a PPBS would be simper.

shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter


Readers Comments (0)

You must be logged in to post a comment.

PowenKo’s Online Store




Recent Posts