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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:30:22+00:00 2026-06-13T12:30:22+00:00

I have a UITableView in an iOS project. When the user selects an item

  • 0

I have a UITableView in an iOS project. When the user selects an item from the table, the object is retrieved from CoreData and stored in a “Player” object. This player object is then passed into another view controller.

My question is: If i make changes to attributes in this Player object, how do i then save those changes. How does CoreData know which Player object changed? I have not set up a playerID attribute as all the Core Data documentation says that it manages its own IDs and references.

MORE:

So, at the moment, im doing this (excuse the pseudo-code, i dont have my source code to hand right now):

Player *player1 = [NSFetchResultController objectAtIndex:0]
Player *player2 = [NSFetchResultController objectAtIndex:1]
GameViewController *gameVC = [[GameViewController alloc] init]
gameVC.player1 = player1;
gameVC.player2 = player2;
gameVC.managedObjectContext = self.managedObjectContext
[self performSegueWithIdentifier:@"Game"]

I am passing in objects of type Player to gameVC, which have no identifier (as Core Data doesnt need explicit ID attributes creating – allegedly!)

So how does the MOC in gameVC know exactly which objects to commit any changes to???

  • 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-13T12:30:23+00:00Added an answer on June 13, 2026 at 12:30 pm

    Changes you make to the Player object apply the the managed object context where the player was fetched into. If you pass your managed object context reference to the new view controller as well, then you can save the managed object context and the changes will be saved.

    Along with all the other changes in that managed object context, so be careful about the changes that are in there.

    To answer your edited question; when you save an moc you aren’t saving particular objects, you are saving all the changes in the manage object context. So it doesn’t need to know which objects to save.

    To add some more explanation: a Managed Object Context is a sort of scratch pad. You pull objects out of a persistent store into the context and you can make changes to it. But those changes are not persistent until they are saved back to the persistent store. If you want to be more granular about your saving, you can create another managed object context with just the objects that you want to change. saving this context only saves those objects. However, changes to objects will not show up in other managed object contexts until you save them back into the persistent store.

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

Sidebar

Related Questions

I have a UITableView on a UIViewController. And this table has say 5 visible
Sorry I'm pretty new to iOS dev. I have a UITableView setup from cells
SCENARIO (iOS 5) I currently have a UITableView. It has 30 table rows The
I have a UITableView in my iOS app that gets refreshed periodically. The user
I have a UITableView within UINavigationController. By default, its UINavigationBar on iOS is stationary.
I have an iOS app with a UITableView that has flexible width, which allow
I have a UITableView that lists comments from various users. I save all of
I have a iOS app that, in a nutshell, uses a UITableView and a
I have a UITableview cell that gets a tally from a core data database.
I am working on a small iOS project, with a UITableView. I made a

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.