Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I not able to override isEqual in my NSManagedObject subclass?

I have two custom NSManagedObject classes: Notes and Tags.

When I override the isEqual: function in the Tags class I get an error message like this:

'Class 'Tags' for entity 'Tags' has an illegal override of NSManagedObject -isEqual:'

Why is this happening?

like image 324
leoyfm Avatar asked Jul 30 '11 14:07

leoyfm


1 Answers

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/CoreDataFramework/Classes/NSManagedObject_Class/Reference/NSManagedObject.html

You're explicitly not allowed to override NSManagedObject -isEqual (see the "Methods you Must Not Override" section in the documentation above). -isEqual's heavily used by the Core Data infrastructure, so if this were allowed, you could cause numerous issues within Core Data.

Depending on what you want to do in your version of -isEqual, you could move it to another method or class.

like image 115
Michael Dixon Avatar answered Nov 08 '22 21:11

Michael Dixon