Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8134767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:09:34+00:00 2026-06-06T10:09:34+00:00

Is initializing a NSManagedObjectContext using NSMainQueueConcurrencyType only for the situation where that MOC has

  • 0

Is initializing a NSManagedObjectContext using NSMainQueueConcurrencyType only for the situation where that MOC has a child MOC that was initialized using NSPrivateQueueConcurrencyType?

To give some background: my app has a traditional structure whereby the main table view is driven by a NSFetchedResultsController and data are imported asynchronously from a web service using an NSOperation subclass that has its own MOC. I wasn’t sure whether both MOCs in that situation should use NSConfinementConcurrencyType (the default, I believe) or whether the MOC associated with the fetched results controller on the main thread should use NSMainQueueConcurrencyType and the background MOC should use NSConfinementConcurrencyType.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T10:09:40+00:00Added an answer on June 6, 2026 at 10:09 am

    First a recipe on Core Data new context types.

    NSMainQueueConcurrencyType creates a context that is associated with the main dispatch queue and thus the main thread. You could use such a context to link it to objects that are required to run on the main thread, for example UI elements.

    NSPrivateQueueConcurrencyType creates and manages a private dispatch queue to operate on. You must use the new methods performBlock: or performBlockAndWait:. The context will then execute the passed blocks on its own private queue.

    Finally, NSConfinementConcurrencyType is the default type and can be used only within the thread where it has been created. So, within your NSOperation, you have used it in the right manner. A simple note. If you want to use it as a child context, you need to have a “queue context” (NSMainQueueConcurrencyType or NSPrivateQueueConcurrencyType).

    Now, about your question.

    Is initializing a NSManagedObjectContext using
    NSMainQueueConcurrencyType only for the situation where that MOC has a
    child MOC that was initialized using NSPrivateQueueConcurrencyType?

    No, not necessary. Yes, you could set up a private context that does some work in background and then pushes the retrieved objects to the main one, but I will do the contrary: use a NSPrivateQueueConcurrencyType as the master context and the NSMainQueueConcurrencyType as a child context for the former. In this way, the main context will deal only with objects that are in memory. Save to disk are performed by the private queue only.

    This approach is used by the UIManagedDocument class. Save to disk are performed in a background thread (a private queue). In this manner the UI is not freezed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Auto-Initializing C# Lists I have a list of integers that has a
When initializing a new Date object in JavaScript using the below call, I found
I have certain initializing functions that I use to set up audit logging on
I'm initializing an instance of a class that tests the equality of two formulas.
I am initializing a NSManagedObject subclass using: - (void)setValuesForKeysWithDictionary:(NSDictionary *)keyedValues I am also knowingly
Is there a way of initializing a static class member after main() has started
I have a VC that I'm initializing, and in it is a View .
Initializing a matrix as so seems to link the rows so that when one
I am trying out initializing lists feature in C++11 using clang installed by MacPorts.
My understanding is that after initializing all frames and widgets in the __init__ method,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.