-[UITableView copyWithZone:]: unrecognized selector sent to instance 0x7XXXXXX00

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

相關文章
相關標籤/搜索