-[UITableView copyWithZone:]: unrecognized selector sent to instance 0x7XXXXXX00ide
-[Class copyWithZone:]: unrecognized selector sent to instance 0x7XXXXXX00post
出现这个错误的缘由是,全局的属性的修饰词写错了,atom
好比一个view 原本应该用weak和strong 修饰,结果你写成了copy 那么就会出现这个错误.net
错误:code
@property (nonatomic,copy) UITableView *tableView; //tableView;对象
正确:blog
@property (nonatomic,strong) UITableView *tableView; //tableView;it
下面来自外国兄台的回答给你们个参考table
Your -setObj1:
method is declared as copy
, so it calls -copy
on your Class1
object. -copy
just calls -copyWithZone:nil
. So you either need to implement the NSCopying
protocol (which means implementing -copyWithZone:
), or change your property from copy
to retain
.class
To make your class respond to copyWithZone:
, you have to implement the NSCopying
protocol in your class. And you must override the copyWithZone:
method.
要实现自定义对象copy,需遵照NSCopying、NSMutableCopying协议,实现copyWithZone、mutableCopyWithZone 方法
更多关于copy请看
https://blog.csdn.net/qq_25639809/article/details/80048843