The following constant is deprecated in iOS 4.2
ADBannerContentSizeIdentifier320x50
So for an app that is already released will this be a problem in future OS versions.
In iOS 4.2 they introduced
ADBannerContentSizeIdentifierPortrait
If I want to support both iOS 4.0 and iOS 4.2 how should I go about it.
You'll have to put in checks whether the constants are available or not. Here's one solution
Class cls = NSClassFromString(@"ADBannerView");
if (cls) {
if (&ADBannerContentSizeIdentifierPortrait != nil) {
kTabnavADBannerContentSizeIdentifierPortrait =
ADBannerContentSizeIdentifierPortrait;
} else {
kTabnavADBannerContentSizeIdentifierPortrait =
ADBannerContentSizeIdentifier320x50;
}
if (&ADBannerContentSizeIdentifierLandscape != nil) {
kTabnavADBannerContentSizeIdentifierLandscape =
ADBannerContentSizeIdentifierLandscape;
} else {
kTabnavADBannerContentSizeIdentifierLandscape =
ADBannerContentSizeIdentifier480x32;
}
ADBannerView *adView = [[cls alloc] initWithFrame:CGRectZero];
adView.requiredContentSizeIdentifiers = [NSSet setWithObjects:
kTabnavADBannerContentSizeIdentifierPortrait,
kTabnavADBannerContentSizeIdentifierLandscape,
nil];
// Set the current size based on device orientation
adView.currentContentSizeIdentifier = kTabnavADBannerContentSizeIdentifierPortrait;
adView.delegate = self;
adView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin |
UIViewAutoresizingFlexibleRightMargin;
// Set intital frame to be offscreen
CGRect bannerFrame =adView.frame;
bannerFrame.origin.y = self.view.frame.size.height;
adView.frame = bannerFrame;
self.bannerView = adView;
[self.view addSubview:adView];
[adView release];
}
develop on lastest iOS target, but set deployment target to 4.0 at your project's build settings and all targets.
来源:https://stackoverflow.com/questions/8223763/adbannercontentsizeidentifier320x50-deprecated-now-what