iOS错误记录

来源:互联网 发布:编程珠玑 编辑:程序博客网 时间:2024/06/10 18:31

错误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/







0 0
原创粉丝点击