zoukankan      html  css  js  c++  java
  • -[UITableView copyWithZone:]: unrecognized selector sent to instance 0x7XXXXXX00

    -[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

     
  • 相关阅读:
    记录心得-IntelliJ iDea 创建一个maven管理的的javaweb项目
    记录心得-FastJson分层解析demo示例
    11.05Mybatis注解
    11.03Mybatis标签
    11.04Mybatis resultMap元素
    11.02Mybatis Mapper映射器
    11.02Mybatis SQL执行方式
    10.30Mybatis配置文件及其元素
    10.30Mybatis三要素
    10.29第一个Mybatis程序
  • 原文地址:https://www.cnblogs.com/isItOk/p/10803683.html
Copyright © 2011-2022 走看看