Setpreferredcontentsize Error in iOS app

Source: Internet
Author: User

Creating "IOS Project" in Xcode 5 causes the following when launching for IPad simulator. The application works for IPhones configuration. I have set the target to being 5 and later and removed AutoLayout as its not compatible with Ios/xcode 5.

I get the following error at launch of IPad app.

2013-08-29 08:53:57.688IosProject[350:C07] -[MasterviewcontrollerSetpreferredcontentsize:]:Unrecognized selector sent to instance0x9e2cc202013-08-29 08:53:57.692IosProject[350:C07] *** TerminatingApp due to uncaught exception' Nsinvalidargumentexception ',Reason: '-[masterviewcontroller setpreferredcontentsize:]: Unrecognized selector sent to instance 0x9e2cc20 '*** First ThrowCall stack:(0x1cd012 0x14c4e7e 0x2584bd 0x1bcbbc 0x1bc94e 0xbe7b 0x624d36 0x85054a 0x8506c3 0x40871e 0x4089a2 0x407876 0x418cb5 0x419beb  0x40b698 0x1f5fdf9 0x1f5fad0  0x142bf5 0x142962 Span class= "lit" >0x173bb6 0x172f44  0x172e1b 0x40717a 0X408FFC  0x6d3d 0x6ca5) 

in IOS7, Uiviewcontroller have a new property preferredcontentsize . A Project made for IOS7 have the following method:
/ span>
-(void) awakefromnib{    = Cgsizemake (320.0480.0);    [Super awakefromnib];}

It therefore sends a setPreferredContentSize: message to your own controller, no matter if the property was implemented or not. To resolve the issue, you might want to avoid setting a property that does not exist:

-(void) awakefromnib{    if ([[[[Uidevice Currentdevice] systemversion] Compare:@ "  7" options:nsnumericsearch]! = nsorderedascending)        {= Cgsizemake (320.0  480.0);    }    [Super awakefromnib];}

Http://stackoverflow.com/questions/18502006/setpreferredcontentsize-error-in-ios-app

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.