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

[NEW] NSArrayController selects inserted NSManagedObject with delay


  • Subject: [NEW] NSArrayController selects inserted NSManagedObject with delay
  • From: Camille GOUREAU-SUIGNARD <email@hidden>
  • Date: Sun, 14 Jan 2007 18:43:47 +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.

But new problem, by using that method, I loose the benefit of NSArraController 'selects inserted object' functionality.



_______________________________________________

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


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>)
 >[SOLVED] NSArrayController selects inserted NSManagedObject with delay (From: Camille GOUREAU-SUIGNARD <email@hidden>)

  • Prev by Date: Re: [SOLVED] NSArrayController selects inserted NSManagedObject with delay
  • Next by Date: Re: Querying key bindings?
  • Previous by thread: Re: [SOLVED] NSArrayController selects inserted NSManagedObject with delay
  • Next by thread: [ANN] C Tutorial: Masters of the Void
  • Index(es):
    • Date
    • Thread