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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:53:42+00:00 2026-06-17T18:53:42+00:00

Since I am coming from those programmers who have used sqlite extensively, perhaps I

  • 0

Since I am coming from those programmers who have used sqlite extensively, perhaps I am just having a hard time grasping how Core Data manages to-many relationships.

For my game I have a simple database schema on paper.

Entity: Level - this will be the table that has all information about each game level

Attributes: levelNumber(String), simply the level number
          : levelTime(String), the amount of time you have to finish the level(this time will vary with the different levels)
          : levelContent(String), a list of items for that level(and that level only) separated by commas
          : levelMapping(String), how the content is layed out(specific for a unique level)

So basically in core data i want to set up the database so i can say in my fetchRequest:

Give me the levelTime, levelContent and levelMapping for Level 1.(or
whatever level i want)

How would i set up my relationships so that i can make this type of fetchRequest?
Also I already have all the data ready and know what it is in advance. Is there any way to populate the entity and its attributes within XCode?

  • 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-17T18:53:43+00:00Added an answer on June 17, 2026 at 6:53 pm

    As you’ve described it, it’s a single Core Data entity, called Level that has four string attributes. Since there’s just the one entity, there are no relationships. You’d create the one entity and add properties so that it looks just like you’ve described it above:

    enter image description here

    Getting just one Level is basic Core Data fetching:

    NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"Level"];
    NSString *levelNumber = @"1";
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"levelNumber = %@", levelNumber];
    [request setPredicate:predicate];
    
    NSError *error = nil;
    NSArray *results = [[self managedObjectContext] executeFetchRequest:request error:&error];
    NSManagedObject *level = nil;
    if ([results count] > 0) {
        level = [results objectAtIndex:0];
    }
    
    // Use level...
    

    If it was me I’d use one of the numeric types for levelNumber, but maybe you have some reason to use a string there. I’d also probably break levelContent into a separate entity, because (a) comma delimited strings are ugly, no matter how you slice ’em, and (b) you might well want the items to have more attributes, and a separate entity would hold those.

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

Sidebar

Related Questions

I have wanted to try GAE since launch, but coming from ASP .NET and
Since Cassandra doesn't have MapReduce built in yet (I think it's coming in 0.7),
Coming from this question , I have a wxComboCtrl with a custom popup made
I have been searching this since yesterday and still nothing. From all that researching
I am coming from a Spring/hibernate background. I have noticed that Rails has no
I just started developing in Java after not having touched it since my college
I keep coming back to this problem, since there doesn't seem to be a
I have the following SQL SELECT statement SELECT bar_id, bar_name, town_name, advert_text FROM bar,
My application is trying to create custom objects from NSImage objects (coming from the
I would like to limit the data that is coming from OneToMany relation. In

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.