Re: [SOLVED] NSArrayController selects inserted NSManagedObject with delay
Re: [SOLVED] NSArrayController selects inserted NSManagedObject with delay
- Subject: Re: [SOLVED] NSArrayController selects inserted NSManagedObject with delay
- From: mmalc crawford <email@hidden>
- Date: Sun, 14 Jan 2007 09:29:12 -0800
On Jan 14, 2007, at 9:11 AM, Camille GOUREAU-SUIGNARD wrote:
OK, it works. Thanks a lot. i did not use it because I also had
instructions in the awakeFromInsert method and I thought it was not
triggered when not using the insert: method (because of the name).
Either you create the MO by using insert: via IB or
[NSEntityDescription insertNewObjectForEntityForName:
inManagedObjectContext:] in your code, awakeFromInsert is triggered.
First, this can easily be tested in code.
In general:
It's not clear why you would think that NSArrayController would change
a fundamental behaviour of Core Data:
"awakeFromInsert is invoked automatically when a newly created managed
object is first inserted into a managed object context."
<http://developer.apple.com/documentation/Cocoa/Conceptual/ModelObjects/Articles/moInitialization.html
>
and
<http://developer.apple.com/documentation/Cocoa/Reference/CoreDataFramework/Classes/NSManagedObject_Class/Reference/Reference.html#//apple_ref/occ/instm/NSManagedObject/awakeFromInsert
>
If you want to give control of creation of the managed object to the
NSArrayController instance (in some circumstances, you may wish to),
you can use 'newObject' then 'addOject:' or
'insertObject:atArrangedObjectIndex:'.
mmalc
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden