• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Setting attribute after creation but before KVO notification is sent (without awakeFromInsert)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: NSImage bug? NEF Files.
  • Next by Date: Help needed in NSSplitView
  • Previous by thread: Re: my Graceful Application Termination doesn't work with my applicationShouldTerminate
  • Next by thread: Help needed in NSSplitView
  • Index(es):
    • Date
    • Thread