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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:54:37+00:00 2026-05-30T02:54:37+00:00

I am a newbie and learning core data from scratch. I’ve got the coredatamodel

  • 0

I am a newbie and learning core data from scratch.
I’ve got the coredatamodel set up, then created NSManagedObject class. Then in the app delegate, I’ve tried to insert some test data. However, it did not work properly. Only the last data was inserted. Should I place

[self saveContext];

in between every object? In “applicationWillTerminate” method, saveContext method is called, hence the last item was saved. (is it correct?)

NSManagedObjectContext *context = [self managedObjectContext];

Vocabulary *vocabulary = [NSEntityDescription
                                   insertNewObjectForEntityForName:@"Vocabulary" 
                                   inManagedObjectContext:context];

vocabulary.word = @"iPhone";
vocabulary.definition = @"better than Android";
vocabulary.level = @"beginner";

vocabulary.word = @"iPhone3gs";
vocabulary.definition = @"better than 3";
vocabulary.level = @"intermediate";

vocabulary.word = @"iPhone4";
vocabulary.definition = @"better than 3gs";
vocabulary.level = @"advanced";

vocabulary.word = @"iPhone4s";
vocabulary.definition = @"better than 4";

vocabulary.word = @"iPhone4s";
vocabulary.definition = @"64 is better than 32";
vocabulary.level = @"advanced";
  • 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-05-30T02:54:39+00:00Added an answer on May 30, 2026 at 2:54 am

    You need to insert a new entity for each of the vocabulary objects you insert. So do this:

    Vocabulary *vocabulary = nil;
    NSManagedObjectContext *context = [self managedObjectContext];
    
    vocabulary = [NSEntityDescription insertNewObjectForEntityForName:@"Vocabulary" inManagedObjectContext:context];
    vocabulary.word = @"iPhone";
    vocabulary.definition = @"better than Android";
    vocabulary.level = @"beginner";
    
    vocabulary = [NSEntityDescription insertNewObjectForEntityForName:@"Vocabulary" inManagedObjectContext:context];
    vocabulary.word = @"iPhone3gs";
    vocabulary.definition = @"better than 3";
    vocabulary.level = @"intermediate";
    
    vocabulary = [NSEntityDescription insertNewObjectForEntityForName:@"Vocabulary" inManagedObjectContext:context];
    vocabulary.word = @"iPhone4";
    vocabulary.definition = @"better than 3gs";
    vocabulary.level = @"advanced";
    
    vocabulary = [NSEntityDescription insertNewObjectForEntityForName:@"Vocabulary" inManagedObjectContext:context];
    vocabulary.word = @"iPhone4s";
    vocabulary.definition = @"better than 4";
    
    vocabulary = [NSEntityDescription insertNewObjectForEntityForName:@"Vocabulary" inManagedObjectContext:context];
    vocabulary.word = @"iPhone4s";
    vocabulary.definition = @"64 is better than 32";
    vocabulary.level = @"advanced";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm learning Prolog from Learn prolog now book. I'm quite newbie in prolog and
I'm a newbie to Asp.net,learning from the Apress's Begining Asp.net...book.While very curious to see
I am a newbie to C++ and learning from the MSDN C++ Beginner's Guide.
I'm learning F# from just a few days, so here's a newbie question: I've
I'm a total C newbie, I come from C#. I've been learning about memory
I am learning RegEx. completely a newbie :P I wanted to separate numbers from
I'm a newbie to Rails and programming in general (currently learning from a book
Is is that I'm a newbie learning Ruby, or does it really have more
Please bear with me, newbie just learning the ropes. I am getting the below
I'm a jquery newbie... still learning the framework.... and here goes my query... The

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.