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 8187491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:34:43+00:00 2026-06-07T02:34:43+00:00

I have three contexts: masterMOC – private queue tied to the persistent store, so

  • 0

I have three contexts:

masterMOC - private queue tied to the persistent store, so physical saves happen here
----mainMOC - main queue tied to the UI, child of masterMOC
-------backgroundMOC - private queue, child of mainMOC

Let’s see I create an Employee object on the mainMOC, then save the mainMOC. Then I save the masterMOC (which writes to disk).

Now, I’ve saved the Employee NSManagedObjectID in a variable, objectID. I want to get this Employee on the backgroundMOC. Does [backgroundMOC objectWithId:objectID] serve this purpose? Will it go to the persistent store and fetch this object using that method? Or will I have to preform a fetch request?

  • 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-07T02:34:44+00:00Added an answer on June 7, 2026 at 2:34 am

    Your’e doing it right. They want you to pass objects between MOContexts using ID’s. objectWithId will hit the persistent store and load the object in a fresh state.
    The only gotcha you have to worry about is this case.

    You fetch an object or create a new object in a MOContext.
    You try pass the objectID to another context WITHOUT SAVING
    The new MOContext wont know about the updates, and if you created a new object the objectID wouldn’t be in the persistent store, so I think it returns nil or it’s not defined.

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

Sidebar

Related Questions

so I have a simple example--a fully crossed three treatment three context experiment, where
I have a problem with sorting NSTableColumn contents. In my NSTableView there are three
Have three classes User, Group and Field. Many to many relationship on User /
Have three divs in a container that I want to float over a large
i have three lists with the same number of elements in each other, i
I have three separate table variables in my Function, 1 of them is not
I have three files: lib.c lib.h => They should be built as a .so
I have <a> elements in two different contexts on my page, some are in
Suppose you have three objects you acquire via context manager, for instance A lock,
I have three zipped folders named [1,2,3] each contains the same project 1 being

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.