tab*_*ber 1 iphone interface-builder ios4 iad ios-4.2
2010年12月16日更新:使用4.2 SDK定位4.0设备时似乎存在类似问题...如果您使用Interface Builder创建广告横幅视图,您的应用会立即崩溃.弱链接iAd框架并在代码方面重新创建广告横幅实现是修复.感谢Ray Wenderlich撰写的这篇主题:http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-app
---
嗨,我刚尝试使用iOS 4.2 SDK(最终版)运行我的应用程序,并针对iOS 4.0设备,即使我的应用程序编译正常,我在运行时立即收到此错误...
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Invalid content size 'ADBannerContentSizePortrait' passed to
ADAdSizeForBannerContentSize'
...
Run Code Online (Sandbox Code Playgroud)
我试过了...
- (void)viewDidLoad {
self.bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
}
Run Code Online (Sandbox Code Playgroud)
...但没有运气,仍然得到相同的崩溃错误.在IB中看起来"尺寸"的唯一选项是"肖像,风景或两者",我猜iOS 4.0不是它的粉丝.
有人有什么建议吗?非常感谢.
这对我有用.似乎4.2以下的操作系统版本仍然需要不推荐使用的内容大小标识符,至少在Interface Builder中创建ADBannerView时.我还将iAd框架弱连接作为预防措施.我希望这对某人有所帮助,并非常感谢本网站上的优秀社区提供的所有精彩信息和见解!
// if the current version of the os is less than 4.2, use the old way of defining the banner size
if ([[[UIDevice currentDevice] systemVersion] compare:@"4.2" options:NSNumericSearch] == NSOrderedAscending) {
adBanner.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];
adBanner.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
NSLog(@"below 4.2");
} else {
adBanner.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
adBanner.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
NSLog(@"4.2 or above");
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2824 次 |
| 最近记录: |