• 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
Getting view to update from changes made in thread using Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting view to update from changes made in thread using Core Data


  • Subject: Getting view to update from changes made in thread using Core Data
  • From: Jeff LaMarche <email@hidden>
  • Date: Fri, 28 Mar 2008 22:39:59 -0400

I'm detaching a thread to handle some processing. In that thread, I create a new NSManagedObjectContext using the same NSPersistentStoreCoordinator from the main thread. I pass into the thread the NSManagedObjectID of an entity and my thread creates new entities and adds them as children of the existing entity. When the thread finished, it saves the Managed Object Context, then calls a method on the main thread that tells the application's main MOC to refreshObject :mergeChanges, passing in the managed object that I added child entities to. I specify YES for merge changes (although using NO doesn't change the results), and then tell it to processPendingChanges.

The data gets correctly saved, but the NSOutlineView and NSTreeController I'm using to display the object and its children doesn't realize it. If I quit and come back in, all the stuff that was added in the thread shows up, but as long as the application is running, the results never show up.

Am I missing some step I need to take in order to tell the outline view or the tree controller that one of the objects it is showing has been updated?

TIA,
Jeff
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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


  • Prev by Date: Re: Core Data faulting and bindings: recursive KVO notifications?
  • Next by Date: Re: machine with null serial number?
  • Previous by thread: Re: NSDictionary with bool and float
  • Next by thread: What's a good way to tell contextual menu apart from main menu?
  • Index(es):
    • Date
    • Thread