Reputation: 253
I'm currently trying to add iAd to my app, I've come across a couple of tutorials and have the following in viewDidLoad
:
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.frame = CGRectOffset(adView.frame, 0, 460.0f);
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
[self.view addSubview:adView];
adView.delegate = self;
self.bannerIsVisible = NO;
Problem is I get warnings for requiredContentSizeIdentifiers
, ADBannerContentSizeIdentifierPortrait
and currentContentSizeIdentifier
because they're now deprecated and my ads do not load.
I've had a mooch at the Apple docs and they seem to be mentioning the same things so I'm confused.
How is it supposed to be correctly implemented?
Upvotes: 2
Views: 1173
Reputation: 436
If you want to add iAds in iOS6 then you have to implement following code.
self.iAddBannerView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, 768, 1024, 66)];
[self.iAddBannerView setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[self.view addSubview:self.iAddBannerView];
self.iAddBannerView.delegate = self;
Upvotes: 4
Reputation: 3905
In your createAdBannerView
method just comment the lines using requiredContentSizeIdentifiers
, ADBannerContentSizeIdentifierPortrait
and currentContentSizeIdentifier
etc.. And hard code the adBanner frame as below(for iPhone Portrait):
[_adBannerView setFrame:CGRectOffset([_adBannerView frame], 320,
-[self getBannerHeight])];
Check your ad load or not.. Its worked for me...(But my app is only supporting the portrait view, and its worked)
Upvotes: 0