各类报错汇集

一、

2016-04-27   23:04:41

 

错误提示:

 -[ZWEditViewController add:]: unrecognized selector sent to instance 0x7fa7fb87abb0 

 二、

2016-05-03  22:13:17

cell不显示数据可能是没有给tableView添加数据源,也没有添加数据源代理,但是不会报错!!!

 三、

2016-05-04 10:31:35

不小心把代码写到

- (void)didReceiveMemoryWarning {

    [super didReceiveMemoryWarning];

}

四、

2016-05-10 11:24:51

NSData *data = [NSData dataWithContentsOfURL:url];下载图片数据的时候,控制台提示:

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

因为在iOS9中,苹果将原http协议改成了https协议,使用 TLS1.2 SSL加密请求数据

需要修改info.plist

修改结果:

五、

 2016-06-20   14:42:03

用UItableViewController的时候,注意一定要改控制器的Class,否则无法显示出数据,也不会报错!!!

六、 

2016-07-06   22:52:06

2016-07-06 22:51:21.701 6.26百思不得姐(初始化设置)[1893:71630] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSInvocation setArgument:atIndex:]: index (2) out of bounds [-1, 1]'

- (IBAction)save {

    UIImageWriteToSavedPhotosAlbum(self.imageView.image, self, @selector(saveSuccess), nil);

}

- (void)saveSuccess

{

    [SVProgressHUD showSuccessWithStatus:@"保存成功"];

}

方法参数越界,即(红字出)需要接收两个参数传给方法。可以去底层查看,它有举例方法

 七、

2016-07-09  19:04:44

 -[__NSCFDictionary user]: unrecognized selector sent to instance 0x7f9275918110

由于在数组中装对象这个代码中的数组名写错:

+ (NSDictionary *)mj_objectClassInArray

{

    return @{@"top_cmd" : [ZWComment class]};  //此处本应该是cmt,纯书写错误

}

八、2016-07-13   23:48:11

注意,在类方法中使用self后面的调用的方法的类型也必须是类方法,否则会报错,找不到方法 

 1 + (void)initialize
 2 {
 3     UITapGestureRecognizer *tap =[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(windowClick)];
 4     [window_ addGestureRecognizer:tap];
 5 }
 6 //必须是类方法,否则会报错
 7 + (void)windowClick
 8 {
 9     ZWLogFunc;
10 }

九、2016-07-23 08:49:24

push出来的控制器如果出现卡顿(控制器为空),直接设置push出来控制器的颜色就OK!

十、2016-07-23 13:51:39

MJExtension中有个一个info.plist,用框架的时候记得得先删除,否则会报错you don't have permission

十一、2016-07-24 16:03:00

addObjectsFromArray与addObject的区别,第一个是把每个元素添加进去,第二个是把元素整体添加进去,在下载网络数据的时候会在setter方法中设置属性值的地方报错!!

十二、2016-08-19 09:26:59

expected  constant-expression' or end of enumerator definition

由于枚举类型内部,使用分号隔开

原文地址:https://www.cnblogs.com/hissia/p/5440851.html