How to correctly implement iAds? iOS6 deprecation issues
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?
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)
如果你想在iOS6中添加iAds,那么你必须实现下面的代码。
self.iAddBannerView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, 768, 1024, 66)];
[self.iAddBannerView setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[self.view addSubview:self.iAddBannerView];
self.iAddBannerView.delegate = self;
链接地址: http://www.djcxy.com/p/66328.html
上一篇: presentModalViewController在iOS6中
下一篇: 如何正确实施iAds? iOS6弃用问题