Re: CoreData - trying to avoid separate thread
Re: CoreData - trying to avoid separate thread
- Subject: Re: CoreData - trying to avoid separate thread
- From: Richard Salvatierra <email@hidden>
- Date: Thu, 4 Jan 2007 16:41:45 -0500
The problem is I am creating new objects and inserting them into a
managedObjectContext.
([NSEntityDescription insertNewObjectForEntityForName: @"Media"
inManagedObjectContext: managedObjectContext])
My understanding, and findings, is that CoreData is not thread safe.
I have a text field bound to an arrayController with a displayPattern
that will show the count of items in that arrayController. This does
not update properly if my import routine is in a separate thread. It
leaves off the last item (for a few seconds anyway, then updates
properly) Unless there is a way to force the controller to update
properly. ArrangeObjects and RearrangeObjects does not do the job.
On Jan 4, 2007, at 4:21 PM, Chris Suter wrote:
On 05/01/2007, at 6:34 AM, Richard Salvatierra wrote:
I am trying to add to a managedContext during the import of
files. When I do this in a separate thread, there are unexpected
behaviors (display pattern does not update).
I am trying to avoid using a separate thread, but I do want the
user to be able to cancel the import while in process. If I am in
a while loop (while files are importing) how can I check for user
input (i.e. mousedown on cancel button)
-Rich
I don't know exactly what you're trying to do, but I think you'd be
better off doing as much as you can in a separate thread and then
when it comes to dealing with things that have to be on the main
thread, use performSelectorOnMainThread:... (or something similar)
to pass data to your main thread and handle it there.
- Chris
_______________________________________________
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