• 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
Loading data in a background thread and displaying it with Bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Loading data in a background thread and displaying it with Bindings


  • Subject: Loading data in a background thread and displaying it with Bindings
  • From: "Paulo F. Andrade" <email@hidden>
  • Date: Wed, 8 Aug 2007 22:51:38 +0100

Hello,

Imagine this simple Core Data model:

List <-->> Item <-->> property

List objects are displayed in an NSOutlineView and Items are displayed in an NSTableView (properties are displayed in another window but it doesn't matter for my question). Everything is set up with Bindings!

I have a background thread loading Item objects into a List using a core data SQLStore.

The problem is how to tell the main thread that there is new data to be displayed, and do it in a Bindings friendly way.

I was already able to do this like so:

Once a while I execute a performSelectorOnMainThread: from the background thread a pass it the objectIDs from objects that have been inserted or updated.

On the main thread this method iterates through those objectIDs and does this:

obj = [context objectWithID:objID];
[context refreshObjct:obj mergeChanges:NO];

This works but it's painfully slow. And most of the objects that participate in that enumeration aren't being displayed at that moment (such as property objects).

So... how can I tell my NSArrayController (the one bound to Items and the NSTableView) to forget what he has and fetch everything again? An [arrayController reload] would be great!!

Can I call the methods willChangeValueForKey:withSetMutation:usingObjects: and didChangeValueForKey:withSetMutation:usingObjects: to trick my controllers into loading the new data?

Thank you for your time!
Any suggestions are welcome!

Paulo F. Andrade 52439@IST
mailto: email@hidden



_______________________________________________

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


  • Follow-Ups:
    • Re: Loading data in a background thread and displaying it with Bindings
      • From: mmalc crawford <email@hidden>
  • Prev by Date: Re: string encoding in NSMutableData
  • Next by Date: mouseMoved: or multiple trackingRects?
  • Previous by thread: Re: Error trying to add NSImage to NSImageCell
  • Next by thread: Re: Loading data in a background thread and displaying it with Bindings
  • Index(es):
    • Date
    • Thread