zoukankan      html  css  js  c++  java
  • setPreferredContentSize error in ios app

    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 be 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.688 IOS Project[350:c07] -[MasterViewController    setPreferredContentSize:]: unrecognized selector sent to instance 0x9e2cc20
    2013-08-29 08:53:57.692 IOS Project[350:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MasterViewController setPreferredContentSize:]: unrecognized selector sent to instance 0x9e2cc20'
    *** First throw call stack:
    (0x1cd012 0x14c4e7e 0x2584bd 0x1bcbbc 0x1bc94e 0xbe7b 0x624d36 0x85054a 0x8506c3 0x40871e 0x4089a2 0x407876 0x418cb5 0x419beb 0x40b698 0x1f5fdf9 0x1f5fad0 0x142bf5 0x142962 0x173bb6 0x172f44 0x172e1b 0x40717a 0x408ffc 0x6d3d 0x6ca5)

    In iOS7, UIViewController has a new property preferredContentSize. A project made for iOS7 has the following method:
    - (void)awakeFromNib
    {
        self.preferredContentSize = CGSizeMake(320.0, 480.0);
        [super awakeFromNib];
    }

    It therefore sends a setPreferredContentSize: message to your own controller, no matter if the property is 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) {
            self.preferredContentSize = CGSizeMake(320.0, 480.0);
        }
        [super awakeFromNib];
    }

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

  • 相关阅读:
    Oracle 查看表空间的大小及使用情况sql语句
    Oracle审计--AUD$占用空间较大处理方案
    system表空间爆满解决方法
    Oracle查询库中记录数大于2千万的所有表
    oracle 百万行数据优化查询
    React (Native) Rendering Lifecycle
    React于React native的渲染机制
    Virtual DOM的渲染机制--猜测
    react的优点:兼容了dsl语法与UI的组件化管理
    What is Babel?---JSX and React
  • 原文地址:https://www.cnblogs.com/savagemorgan/p/3848839.html
Copyright © 2011-2022 走看看