iOS错误记录

36 篇文章 0 订阅
8 篇文章 0 订阅

错误1:linker command failed with exit code 1

原因:引入第三方库很常见到“inker command failed with exit code 1 (use -v to see invocation)”错误。今天也有幸邂逅了。


处理:具体解决方法,请移步下面地址:http://blog.csdn.net/duxinfeng2010/article/details/8265273

错误2:如何实例化storyboard中创建的viewcontroller

处理:在调用之前,需要在storyboard里,给目标ViewController设置identifier,然后

// 从storyboard创建MainViewController
    UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"nailshop" bundle:[NSBundle mainBundle]];
    YLSMainViewController *mainViewController = (YLSMainViewController*)[storyboard instantiateViewControllerWithIdentifier:@"mainViewController"];
    [self presentViewController:mainViewController animated:YES completion:nil];
参考:( http://blog.csdn.net/kyfxbl/article/details/17687265

错误3:NSInternalInconsistencyException

错误:uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
原因:直接使用了self.tableView,并未对其实例化
处理:创建storyboard或xib,实例化view后再使用

错误4:whose view is not in the window hierarchy!

原因:从stroyboard中取controller时候出现问题
处理:不在ViewDidLoad方法中调,而是在viewDidAppear:方法中调
参考:http://stackoverflow.com/questions/11862883/whose-view-is-not-in-the-window-hierarchy

错误5:[NSNull countByEnumeratingWithState:objects:count:]: unrecognized selector

原因:使用空对象调用了countBy……方法

处理:增加判断条件,判断为空不执行,由于接收到的空为:<null>因此不能用==,nil,Nil,等常规方法,使用![resultArrisEqual:[NSNullnull]]

参考:http://blog.csdn.net/hg_lin/article/details/16965137

错误6: Unknown type name 'CGRect'; did you mean 'Rect'?

原因:在xcode6以前构建的工程是携带pch文件,里面默认有如下句子

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
#endif

而在xcode6构建的是需要手动引入的。

处理:引入<UIKit/UIKit.h>

参考:http://stackoverflow.com/questions/26169273/cgrect-unrecognized-in-subclasses-of-nsobject

错误7:could not set nil as the value for the key 

原因: 使用KVC设置could not set nil as the value for the key 时候遇到了空值

处理:重写setNilValueForKey,

参考:http://supershll.blog.163.com/blog/static/3707043620121144446889/







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值