• 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
[SOLVED] NSArrayController selects inserted NSManagedObject with delay
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SOLVED] NSArrayController selects inserted NSManagedObject with delay


  • Subject: [SOLVED] NSArrayController selects inserted NSManagedObject with delay
  • From: Camille GOUREAU-SUIGNARD <email@hidden>
  • Date: Sun, 14 Jan 2007 18:11:27 +0100

I often use the insert: method on an arrayController (whose mode is entity, and is set to select inserted objects).

In what situations are you using -[NSArrayController insert:] to create a managed object from within code? Generally, you should only use this as a user interface action; it's declared as an IBAction, and methods that are declared as IBAction are generally intended to manage the whole response to the user themselves; part of this, as you've seen, is that they may need to delay certain things for programmatic purposes even though there will be no perceptible delay to the user.


To create a managed object in your code, use -[NSEntityDescription insertNewObjectForEntityForName: inManagedObjectContext:] instead. This will return the managed object, after invoking its - awakeFromInsert, and you can do further things to it before returning to the user.

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.


Thanks again.

Camille


-- Chris



Et mon blog: www.lutin-ludique.com/bradype/


_______________________________________________

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


  • Follow-Ups:
    • [NEW] NSArrayController selects inserted NSManagedObject with delay
      • From: Camille GOUREAU-SUIGNARD <email@hidden>
    • Re: [SOLVED] NSArrayController selects inserted NSManagedObject with delay
      • From: mmalc crawford <email@hidden>
References: 
 >NSArrayController selects inserted NSManagedObject with delay (From: Camille GOUREAU-SUIGNARD <email@hidden>)
 >Re: NSArrayController selects inserted NSManagedObject with delay (From: Chris Hanson <email@hidden>)

  • Prev by Date: Re: Child windows
  • Next by Date: Re: Child windows
  • Previous by thread: Re: Swap NSWindow positions with setFrame at the same time
  • Next by thread: Re: [SOLVED] NSArrayController selects inserted NSManagedObject with delay
  • Index(es):
    • Date
    • Thread