How going, dudes?
So today it’s a really ridiculous question, but i just can’t get it to work the way i want.
I’m implementing the AdMob stuff but i want to get some additional information.
They gave the instructions on the GoogleCodes/AdMob
but i can’t make it give me the logs i want.
This is on the .h
#import <UIKit/UIKit.h>
#import "GADBannerView.h"
#import "GADBannerViewDelegate.h"
@interface AppForAllTestsViewController : UIViewController<GADBannerViewDelegate>
This is on the .m
-(void)adViewDidReceiveAd:(GADBannerView *)bannerView{
NSLog(@"RECEIVED");
[UIView beginAnimations:@"BannerSlide" context:nil];
bannerView.frame = CGRectMake(0.0, self.view.frame.size.height - bannerView.frame.size.height,
bannerView.frame.size.width,
bannerView.frame.size.height);
[UIView commitAnimations];
}
-(void)adView:(GADBannerView *)view didFailToReceiveAdWithError:(GADRequestError *)error{
NSLog(@"FAILURE RECEIVING AD: %@", [error localizedDescription]);
}
-(void)adMobProcess{
adMobBanner = [[GADBannerView alloc]initWithFrame:CGRectMake(0.0,
self.view.frame.size.height-GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
adMobBanner.adUnitID = my_id;
adMobBanner.rootViewController = self;
[self.view addSubview:adMobBanner];
[adMobBanner loadRequest:[GADRequest request]];
}
-(void)awakeFromNib{
NSLog(@"GOOD MORNING");
[adMobBanner setDelegate:self];
}
- (void)viewDidLoad{
[self adMobProcess];
[super viewDidLoad];
}
You can see that i’m setting the delegate to “self” but nothing happens, none of the changes, can any one, please, help me? (:
The AdMob iOS documentation states:
Because you set the delegate in awakeFromNib, you are either setting the delegate before initializing the adMobBanner (NPE?), or you are setting it after the adRequest. You should instead set the delegate in adMobProcess before calling loadRequest.