bindings from threads
bindings from threads
- Subject: bindings from threads
- From: "Jim Thomason" <email@hidden>
- Date: Thu, 5 Oct 2006 12:47:22 -0500
I have an app that's using bindings and an array controller to manage
data in an NSTableView. It's a networked app that brings in data from
the net and tosses it into the array, which should then be
automatically reflected in the view.
First question is, I tend to get seemingly random crashes when it does
the refresh. Some of the time it'll work, some of the time it won't.
I'm manually handling the binding notifications here, along these
lines:
[self willUpdateValueForKey:@"myArray"];
//interesting things, receive data, add on to myArray
[self didUpdateValueForKey:@"myArray"];
I've found that I can eliminate these crashes by instead accumulating
into a new array, then adding on those array elements to my master
array and sending my notifications from the main thread, instead of my
watcher thread.
Is this expected behavior? Should I not be able to do this from a
secondary thread and only from the main thread? Or does this indicate
that something else is going on?
Secondly, is this the best way to do something like this? I don't want
to fall back to the old way of using the data source and doing it all
manually, but I would be interested in other binding approaches.
Alternatively, I know that I can add an IBOutlet to my array
controller and use that to just add the objects and not worry about
the bindings notes. Would one way be preferrable to another? Which
would be a more common approach?
Thanks,
-Jim....
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden