• 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
Re: How to send fetchrequest to main context from a local context on a separate thread?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: How to send fetchrequest to main context from a local context on a separate thread?
      • From: Mikkel Islay <email@hidden>
References: 
 >How to send fetchrequest to main context from a local context on a separate thread? (From: Koen van der Drift <email@hidden>)
 >Re: How to send fetchrequest to main context from a local context on a separate thread? (From: Koen van der Drift <email@hidden>)
 >Re: How to send fetchrequest to main context from a local context on a separate thread? (From: Mike Abdullah <email@hidden>)

  • Prev by Date: [SOLVED] NSUbiquitousKeyValueStoreDidChangeExternallyNotification
  • Next by Date: Re: How to send fetchrequest to main context from a local context on a separate thread?
  • Previous by thread: Re: How to send fetchrequest to main context from a local context on a separate thread?
  • Next by thread: Re: How to send fetchrequest to main context from a local context on a separate thread?
  • Index(es):
    • Date
    • Thread