-[UITableView copyWithZone:]: unrecognized selector sent to instance 0x7XXXXXX00
-[Class copyWithZone:]: unrecognized selector sent to instance 0x7XXXXXX00
出现这个错误的原因是,全局的属性的修饰词写错了,
比如一个view 本来应该用weak和strong 修饰,结果你写成了copy 那么就会出现这个错误
错误:
@property (nonatomic,copy) UITableView *tableView; //tableView;
正确:
@property (nonatomic,strong) UITableView *tableView; //tableView;
下面来自外国兄台的回答给大家个参考
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.
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