iOS学习(项目中遇到的错误1)

1.[AppModel copyWithZone:]: unrecognized selector sent to instance 0x7ffda9f4cf70

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppModel copyWithZone:]: unrecognized selector sent to instance 0x7ffda9f4cf70'

*** First throw call stack:

这种错误的原因:属性定义的问题应该注意在定义属性时即在定义

property时几个出现问题的可能能

                               nonatomic:单线程,效率较高

                                atomic:多线程,效率优点低,但是是默认的

                                readWrite:可读可写,它也是默认的

                                readOnly:只可读

                                assign:指的是int,float.等数值类型,他是默认的

                                copy:指的是字符串对象。例如名字

                                retain:指的是对象。例如时间对象

                                strong:强引用

                                weak:弱引用

我出错的原因就是在定义类对象时,误用了copy代替strong 

2. 在使用tableView时会发现有时这个方法不执行,原因:_tableViewframe未设置,还有就是_dataArry未赋值是空的。还有一种就是在取的数据时采用的是异步的方式,但是木有刷新tableView数据

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    return nil;

}         

3.数据NSData未初始化带来的错误

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil'

4.如果取出的数据有为空时就会出现如下错误

 *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 3 beyond bounds [0 .. 2]'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值