2011-11-22 73 views
0

我有以下iAds代碼。does currentContentSizeIdentifier存在於iOS 4.0和4.1中

[_iAdAdView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierPortrait]; 

但是這段代碼會在iOS 4.0和iOS 4.1設備中拋出「EXC_BAD_ACCESSS」。

的醫生說,這是從的iOS 4.0及更高版本 http://developer.apple.com/library/ios/#documentation/userexperience/Reference/ADBannerView_Ref/Reference/Reference.html

那麼,爲什麼代碼崩潰的iOS 4.0和iOS 4.1,而不是適用於iOS 4.2及更高版本。

如何解決爲iOS 4.0和iOS 4.1設置所需設置的問題。

編輯: 我發現在源代碼AdBannerView.h的解決方案,並注意到 「ADBannerContentSizeIdentifierPortrait」 是僅適用於iOS 4.2 availabled

+0

EXC_BAD_ACCESS並不意味着該代碼不支持或在該版本中不存在,這意味着_iAdAdView對象被過度釋放或不再存在或未初始化。 – jrturton

+0

它表示'',所以當代碼在一個OS版本上工作而不在另一個上時。 – Anand

回答

0

我發現在源代碼AdBannerView.h的解決方案,並注意到「ADBannerContentSizeIdentifierPortrait」是僅適用於iOS 4.2 availabled

2

這是文件說什麼

的放置在currentContentSizeIdentifier屬性 中的標識符必須包含在 requiredContentSizeIdentifiers屬性中存儲的標識符集合中。這可以確保視圖顯示的 廣告在尺寸更改後仍可以顯示。 設置 requiredContentSizeIdentifiers屬性中未包含的值會導致拋出異常爲 。

查看大膽的部分。那是什麼可能導致異常。

+0

你是對的,已發佈相關問題,然後http://stackoverflow.com/questions/8223763/adbannercontentsizeidentifier320x50-deprecated-now-what – Anand