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

  • SEARCH
  • Home
  • 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 8161767
In Process

The Archive Base Latest Questions

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

Usually in a single threaded application, the main managed object context would reside in

  • 0

Usually in a single threaded application, the main managed object context would reside in the AppDelegate, and we’d access it via appDelegate.mainMOC. But now that Apple’s introduced nested contexts (parent and child), they’re recommending the “pass the baton” approach:

Nested contexts make it more important than ever that you adopt the
“pass the baton” approach of accessing a context (by passing a context
from one view controller to the next) rather than retrieving it
directly from the application delegate.

But I don’t really see how introducing nested contexts make it “more important than ever”. Why can’t I just have three contexts in the AppDelegate (masterMOC, mainMOC, extraMOC)? What would be the problem with that, and why is Apple recommending against that approach?

  • 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-06T18:34:11+00:00Added an answer on June 6, 2026 at 6:34 pm

    Having all that in the app delegate was a bad idea in the first place. It breaks all kinds of software design rules.

    Having said that, the idea is that you do not want to have to write code all over the place that must know exactly which context things like in. With your proposed solution, all code will have to know to use moc1, moc2, or moc3. That is very brittle.

    Ideally, you will pass a MOC to code, and that code uses the MOC it was given. If it needs to create a scratch, it can create a child of the MOC passed to it (assuming, of course, that the MOC is not confinement-type).

    One approach is to pass objects, and don’t worry about the exact MOC. Simply query the managedObjectContext property of the managed object when necessary.

    Note, that keeping stuff in the app delegate means you are using it as a “kitchen sink” and is, in some ways, just glorified global variables.

    BTW, it’s “more important than ever” because the newer threading policies are more strict and your code is pretty much guaranteed to die a horrible death if you get threading wrong.

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

Sidebar

Related Questions

Regular Expressions are usually expressed as strings, but they also have properties (ie. single
I noticed that on a single threaded application, SDL still spawns some threads on
I have a small single-threaded C++ application, compiled and linked using Visual Studio 2005,
A single threaded program running a loop of 500 million iterations takes usually about
Usually I tend to install things via the package manager, for unixy stuff. However,
Usually, I try to set my folders to have permission 775, but some web-hosting
Multi-threading usually means locking critical sections, etc. So I can't help but wonder, in
We usually have a single word for most complexities we encounter in algorithmic analysis:
So we have foods, which are usually of one single unit and recipes, which
I have a single crystal report that usually ends up about 150 pages long.

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.