Question

I want to ad a methode to an object (subclassed from NSManagedObject)

@interface REMBox : NSManagedObject {
}
- (int)singleValueForIndex:(int)index;
@property (nonatomic,retain) NSString *name;    

but that methode can't be used

REMBox *box = ....
BOOL canCallMessage = [box respondsToSelector:@selector(singleValueForIndex:)];
// canCallMessage is NO
int a = [box singleValueForIndex:4];
// that crashes :-(

what's my fault. The normal (core-data) attributes of REMBox work well.

Was it helpful?

Solution

Did you set the new subclass REMBox as class to be used for your entity in your datamodel?

Class "Event" for entity "Event" in this sample. Never forget to make a clean rebuild (sometimes even reopen your xcode project) if core data does unexpected things.

CoreData entity class

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top