[英]iAd works on simulator but crash on device(ipad)
我正在嘗試將iAd集成到我的應用中,這是我的工作
<iAd/iAd.h>
self.canDisplayBannerAds = YES;
在viewDidLoad方法中。 該應用程序在兩個模擬器上均能正常運行,我可以在應用程序底部看到橫幅。
但是,當我在iPad(運行IOS 6.1)上對其進行測試時,該應用程序崩潰了,這就是我得到的。
2014-04-19 19:25:56.409 TestiAd[12771:907] -[ViewController setCanDisplayBannerAds:]: unrecognized selector sent to instance 0x1fd7b620
2014-04-19 19:25:56.413 TestiAd[12771:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController setCanDisplayBannerAds:]: unrecognized selector sent to instance 0x1fd7b620'
*** First throw call stack:
(0x336442a3 0x3b4e497f 0x33647e07 0x33646531 0x3359df68 0xfb125 0x3546b595 0x354abd79 0x354a7aed 0x354e91e9 0x354ac83f 0x354a484b 0x3544cc39 0x3544c6cd 0x3544c11b 0x371555a3 0x371551d3 0x33619173 0x33619117 0x33617f99 0x3358aebd 0x3358ad49 0x354a3485 0x354a0301 0xfb3a5 0x3b91bb20)
libc++abi.dylib: terminate called throwing an exception
(lldb)
我在SO上有很多類似的問題,但是其中許多與在iPad上以可計算模式運行iPhone應用程序有關,但事實並非如此,我正在Universal應用程序上進行測試。
問題出在iOS版本上。
在Doc中 : canDisplayBannerAds
在iOS7中引入,在iOS6中不存在。
因此,您可能想做:
if ([self respondsToSelector:@selector(setCanDisplayBannerAds:)])
self.canDisplayBannerAds = YES;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.