Reputation: 3114
I'm not getting any error or something.
I created a CustomView file, but it doesn't seem to work.
//CustomView.h
#import "GADBannerView.h"
@interface CustomView : UIView
{
GADBannerView *bannerView_;
}
Second file:
//CustomView.m
bannerView_ = [[GADBannerView alloc] initWithFrame:CGRectMake(0.0, 430, 320, 50)];
bannerView_.adUnitID = MY_BANNER_UNIT_ID;
bannerView_.rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
NSLog(@"%@",bannerView_.rootViewController);
[self addSubview:bannerView_];
GADRequest *request = [GADRequest request];
request.testDevices = [NSArray arrayWithObjects: GAD_SIMULATOR_ID, nil];
[bannerView_ loadRequest:request];
Upvotes: 1
Views: 589
Reputation: 16865
As per the documentation, you should allocate your banner like this:
[[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait];
With the size you need, of course :)
Upvotes: 3
Reputation: 3114
As @JackWu said, I need to use:
[[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait];
Upvotes: 0
Reputation: 504
GADRequest.isTesting = YES;
should be set.
Also, are there any messages in your Xcode Console?
Upvotes: 0