FROM : Mike Abdullah
DATE : Mon Dec 31 12:43:04 2007
Please read the documentation on -[NSManagedObject
initWithEntity:insertIntoManagedObjectContext:]
Mike.
On 31 Dec 2007, at 10:46, Michael Grützner wrote:
> Hi List,
>
> I have created a class MyEntity which is a subclass of
> NSManagedObject. The Entity contains
> one attribute ("name") and one to-many relationship ("myRelation").
> In MyEntity I override the following two methods and I have one
> initWithName: method:
>
> - (id) valueForKey:(NSString *)key; {
> return [super valueForKey:key];
> }
>
> - (void) setValue: (id)value forKey: (NSString *)key {
> [super setValue:value forKey:key];
> }
>
> - (id) initWithName: (NSString *) newName {
> self = [super init];
>
> if(self)
> [self setValue:newName forKey:@"name"];
>
> return self;
> }
>
>
> Then I try to add an instance of MyEntity to an NSArrayController
> via addObject: with the code:
>
> MyEntity *entity = [[MyEntity alloc] initWithName:@"My Name"];
> [super addObject:entity];
>
> While adding the object to the NSArrayController I get the following
> exception:
>
> [<MyEntity 0x183310> setValue:forUndefinedKey:]: the entity (null)
> is not key value coding-compliant for the key name.
>
> What is the reason for the exception? Do I have to add custom
> accessor methods to MyEntity? If yes, how might these methods
> look like for a to-many relationship?
>
> Thank you very much in advance,
> Michael
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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/<email_removed>
>
> This email sent to <email_removed>
DATE : Mon Dec 31 12:43:04 2007
Please read the documentation on -[NSManagedObject
initWithEntity:insertIntoManagedObjectContext:]
Mike.
On 31 Dec 2007, at 10:46, Michael Grützner wrote:
> Hi List,
>
> I have created a class MyEntity which is a subclass of
> NSManagedObject. The Entity contains
> one attribute ("name") and one to-many relationship ("myRelation").
> In MyEntity I override the following two methods and I have one
> initWithName: method:
>
> - (id) valueForKey:(NSString *)key; {
> return [super valueForKey:key];
> }
>
> - (void) setValue: (id)value forKey: (NSString *)key {
> [super setValue:value forKey:key];
> }
>
> - (id) initWithName: (NSString *) newName {
> self = [super init];
>
> if(self)
> [self setValue:newName forKey:@"name"];
>
> return self;
> }
>
>
> Then I try to add an instance of MyEntity to an NSArrayController
> via addObject: with the code:
>
> MyEntity *entity = [[MyEntity alloc] initWithName:@"My Name"];
> [super addObject:entity];
>
> While adding the object to the NSArrayController I get the following
> exception:
>
> [<MyEntity 0x183310> setValue:forUndefinedKey:]: the entity (null)
> is not key value coding-compliant for the key name.
>
> What is the reason for the exception? Do I have to add custom
> accessor methods to MyEntity? If yes, how might these methods
> look like for a to-many relationship?
>
> Thank you very much in advance,
> Michael
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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/<email_removed>
>
> This email sent to <email_removed>
| Related mails | Author | Date |
|---|---|---|
| Michael Grützner | Dec 31, 11:46 | |
| Mike Abdullah | Dec 31, 12:43 |






Cocoa mail archive

