Ad Banner Content Size crashes device?
Recently I integrated iADs into my project and while setting the size of the adBannerView to portrait or landscape, I used
[_adBannerView setCurrentContentSizeIdentifier: ADBannerContentSizeIdentifier480x32];
and
[_adBannerView setCurrentContentSizeIdentifier: ADBannerContentSizeIdentifier320x50];
This worked on the simulator, but I got warnings that the code was deprecated. So I changed the code to
[_adBannerView setCurrentContentSizeIdentifier: ADBannerContentSizeIdentifierLandscape];
and
[_adBannerView setCurrentContentSizeIdentifier: ADBannerContentSizeIdentifierPortrait];
开发者_如何学Go
and the warnings went away and i worked fine on my simulator. However, when I tested out my app on my device(iOS 4.1), The GDB gives me a EXC_BAD_ACCESS error. When I switched back to the earlier code(480x32), the app works fine on my device.
So in a nutshell, my device can run apps which use deprecated iAD methods, and crashes when the current iAD methods are used.
Anyone know why? Also, will Apple reject my app if I use deprecated methods?
Thanks
if your device iOS version is less then 4.2, it will crash because there is no declaration for ADBannerContentSizeIdentifierLandscape
and ADBannerContentSizeIdentifierPortrait
. You can do a check and see what version the iOS device has, and add ADBannerContentSizeIdentifierPortrait
and ADBannerContentSizeIdentifierLandscape
only if the version is 4.2 or higher, however you can safely use ADBannerContentSizeIdentifier480x32
and ADBannerContentSizeIdentifier320x50
.
Here's a sample on how you can do that: Check iPhone iOS Version
精彩评论