Setting attribute after creation but before KVO notification is sent (without awakeFromInsert)
Setting attribute after creation but before KVO notification is sent (without awakeFromInsert)
- Subject: Setting attribute after creation but before KVO notification is sent (without awakeFromInsert)
- From: George Orthwein <email@hidden>
- Date: Thu, 29 Jun 2006 10:06:05 -0400
Hi everybody,
I've registered to observe "arrangedObjects.name" on an array
controller managing an entity. I create the object with:
[NSEntityDescription insertNewObjectForEntityForName: @"EntityName"
inManagedObjectContext: context];
in the same method I set an attribute:
[myObject setValue:name forKey:@"name"];
The observer gets two notifications, once on object creation and once
when the name value is set. Is there any way to avoid the first
notification?
I've tried other methods of object creation with no success (via
controller, via initWithEntity). I can't really set the attribute in -
awakeFromInsert because the value is determined by a controller.
I can actually easily disregard the first notification just by
checking for the default value of "name". But I wanted to make sure I
wasn't overlooking something else basic.
Thanks all!
George
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden