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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:18:12+00:00 2026-06-01T01:18:12+00:00

UPDATE: I had ghost entries in my database of games without players from before

  • 0

UPDATE: I had ghost entries in my database of games without players from before I implemented Players at all. It was returning those entries not the latest entries with the updated Model

I am working to get a Core Data database working and having some trouble with relationships. I’m very new to the whole thing so don’t put anything past me I may no even understand the basics. But here we go anyway.

This is where I create a new Game Entity. The Players is a to-may relationship to Several Player entities that were selected and stored in an array.

    Game *newGame = [NSEntityDescription insertNewObjectForEntityForName:@"Game" inManagedObjectContext:[SDDataManager dataManager].managedObjectContext];
    [newGame setGameType:@"multipleChoice"];
    [newGame setDate:[NSDate date]];
    NSSet *playersSet = [NSSet setWithArray:players];
    [newGame setPlayers:playersSet];
    [newGame setCards:[NSKeyedArchiver archivedDataWithRootObject:selectedCards]];

    NSError *error;
    [[SDDataManager dataManager].managedObjectContext save:&error];
    NSLog(@"New Game Error: %@",[error localizedDescription]);

The problem is that when I call it out of the database like this:

NSFetchRequest *requestSavedGame = [NSFetchRequest fetchRequestWithEntityName:@”Game”];
[requestSavedGame setFetchLimit:1];

NSError *error;
NSArray *loadedGame = [[SDDataManager dataManager].managedObjectContext executeFetchRequest:requestSavedGame error:&error];
NSLog(@"Load Game Error: %@",[error localizedDescription]);

Game *game = [loadedGame objectAtIndex:0];
NSLog(@"Players Set: %@",game.players);
NSLog(@"Players: %@",[game.players allObjects]);

The Players: is empty?? It returns this exactly:

Players Set: Relationship 'players' fault on managed object (0xd023b70) <Game: 0xd023b70> (entity: Game; id: 0xd023180 <x-coredata://E6A82377-31D2-4D11-B890-B3FDC5A03E0E/Game/p1> ; data: {
cards = <62706c69 73743030 d4010203 0405086e 6f542474 6f705824 6f626a65 63747358 24766572 73696f6e 59246172 63686976 6572>;
currentPlayer = 0;
date = "2012-03-27 18:20:07 +0000";
gameType = multipleChoice;
players = "<relationship fault: 0xd01fd60 'players'>";
})

Players: ( )

I have no understanding why the players is a full array, then a full set when it goes in but when it comes out the [set allobjects] returns an empty array…

  • 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-01T01:18:13+00:00Added an answer on June 1, 2026 at 1:18 am

    I would suggest you to use valueForKey for whatever key.

    In core data fault is not an error, it means you are trying to access from core data which does not exist. and i would say you should use setPropertiesToFetch which specifies which properties should be returned by the fetch.

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

Sidebar

Related Questions

UPDATE!!! Suggested answer is NOT correct, my mistake. The #container DIV should've had float:left;.
I pulled from origin to update my local, and one file had conflicting changes.
I recently had to update one of my model's properties from type StringProperty to
Im not sure what's happening here. But I had an update panel on my
Our server recently had an update done (PHP was updated from 5.2.x to 5.3.14)
[Update] Unfortunately I never had an opportunity to solve this problem. However, there are
I've had problems with the update method in subsonic, so instead of using: a.Update()
i'm trying to update the hibernate dependecy in my pom, I had the 3.3.2.GA
Prior to the asp.net 4 RC update, I had been using the WebApi for
I recently made an update to JasperReports library version 4.1.3. Previously, I had 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.