I have a simple question:
I have a NSManagedObject subclass that I've been using for some time and it was working perfectly fine.
Today I added a new property to it with the corresponding iVar. The property is a simple (nonatomic,retain) NSString *.
And as normal i added @synthesize to the property to generate setter and getter functions.
However, there is no way i can use the newly defined property!!! I keep getting "property not found on object of type" error and my build fails.
Here are a few chunks of code that will clear things out:
//import the core data header first CoreData/CoreData.h @interface Contact : NSManagedObject { NSString *contactID; NSString *firstName; NSString *myDevMod; } @property (nonatomic,retain) NSString *contactID; @property (nonatomic,retain) NSString *firstName; @property (nonatomic,retain) NSString *myDevMod; @end
and the corresponding .m implementation:
#import "Contact.h" @implementation Contact @synthesize contactID, firstName, myDevMod;
and the code that uses the Contact class:
#import "Contact.h" //at the start Contact *aContact = [[Contact alloc] init]; aContact.contactID = someId; //works perfectly fine aContact.firstName = someName; //works perfectly fine aContact.myDevMod = @""; //THIS IS WHERE THE ERROR OCCURS!! [aContact doSomethingHere]; [aContact release];
What do you think could be the error??
Thanks in advance for your support.
Best Answer
Weirdly the site won't let me add a comment so :
comment: Sounds odd. First thing I'd try is removing the @property lines and @synthesize line - so the getters and setters are created automagically. Also try: aContact.myDevMod = someName; to see if that actually works - might shed some light.