Hi All,
I have a problem with core data. Probably caused by my lack of understanding.
Below is the header file for the attribute I am bringing in from core data. I
want to add a convenience method to this class indicated as -
(ADDITIVE_WARNING_TYPE)returnAdditiveWarningByType below.
The issue is when this method is called I get the error below
iPhone Simulator 3.1 (139.1), iPhone OS 3.1.2 (7D11)
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '*** -[NSManagedObject returnAdditiveWarningByType]: unrecognized
selector sent to instance 0x3a2d580'
It is called like this in the code
AdditiveEntity *additiveEntity = (AdditiveEntity *)[fetchedResultsController
objectAtIndexPath:indexPath];
if ([additiveEntity returnAdditiveWarningByType] ==
ADDITIVE_WARNING_TYPE_WARNING)
{
....
}
This indicates that despite the fact I have cast the object to an
additiveEntity the class I am trying to apply this to is of type
NSManagedObject not my class at all. So my questions are am I a complete idiot
and have missed something simple? Am I able to add convenience methods to the
classes that core data generates for use as the entity classes if so can
someone tell me what am I doing wrong? Is there something stopping me from
casting the result of [fetchedResultsController objectAtIndexPath:indexPath] to
a AdditiveEntity which is a subclass of NSManagedObject anyway?
This is a very perplexing problem as I am sure it is something dumb I am doing
but can not see it. Thanks in advance for any assistance.
Regards
Damien
typedef enum _ADDITIVE_WARNING_TYPE
{
ADDITIVE_WARNING_TYPE_NONE = 0
}ADDITIVE_WARNING_TYPE;
@interface AdditiveEntity : NSManagedObject {
}
@property (retain, nonatomic) NSString *identifier;
@property (retain, nonatomic) NSString *name;
@property (retain, nonatomic) NSString *type;
@property (retain, nonatomic) NSString *description;
@property (retain, nonatomic) NSString *acknowledgement;
@property (retain, nonatomic) NSString *warning;
@property (assign) int additive_notification;
- (ADDITIVE_WARNING_TYPE)returnAdditiveWarningByType;
@end
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]