Re: How to send fetchrequest to main context from a local context on a separate thread?
Re: How to send fetchrequest to main context from a local context on a separate thread?
- Subject: Re: How to send fetchrequest to main context from a local context on a separate thread?
- From: Koen van der Drift <email@hidden>
- Date: Fri, 19 Oct 2012 08:54:00 -0400
Here's what you want:
>
> __block BOOL exists;
> dispatch_sync(dispatch_get_main_queue, ^{
> NSManagedObjectContext *context = … // grab the context
> exists = … // query the context to see if the data already exists
> });
Thanks Mike, that works very nice.
Unfortunately, after all the importing, I now end up with an empty
table in my UI, so with all the thread switches I must be forgetting
something. (it worked fine when just using the main thread).
So is there a way in Xcode to follow threads and (visually) get an
idea about what happens on each one, so I can debug this? I have seen
all the threads pop up in the left column during the execution, but I
find that kinda difficult to follow.
- Koen.
_______________________________________________
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