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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:39:14+00:00 2026-05-16T21:39:14+00:00

I’ve got an app using CoreData as a data storage mechanism and the app

  • 0

I’ve got an app using CoreData as a data storage mechanism and the app needs some initial data to be configured. Are there any recommendations / what/how are you doing in order to set up the initial data?

Currently I am doing it in the following way (when the app starts for the 1st time):

SomeEntity *newEntity=[NSEntityDescription insertNewObjectForEntityForName:@"SomeEntity" inManagedObjectContext:context];
[newEntity setCode:@"a-code"];
[newEntity setName:@"a-name"];
...
[context save:nil];

I do not like this approach for 2 reasons:
1) it’s so boring and error-prone if you need more than 10 entity instances for more than one entity type
2) it may take up some time for the initial start-up

In previous apps using SQLite I just linked my initial SQLite database into the app and, if needed to modify any data, moved the database to the Documents directory. Is there any similar approach for CoreData?

  • 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-16T21:39:14+00:00Added an answer on May 16, 2026 at 9:39 pm

    That’s exactly what you’d do with Core Data, too. Use your app to create the data the way you want, and then download the data from the device. You’ll find a SQLite file in the Documents directory (which is the default location). Add the SQLite file to your project as a resource. It’ll get copied along with your app.

    Then, all you need to do is write some code to determine if a file already exists in the Documents directory on startup. If not, you can copy the file from your application’s bundle to the Documents directory and Core Data will open that. You just want to make sure to do this before the NSPersistentStoreCoordinator is set up.

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

Sidebar

Ask A Question

Stats

  • Questions 545k
  • Answers 545k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • added an answer Well, start off by thinking of which bits of data… May 17, 2026 at 9:17 am
  • added an answer For this task it is a good idea to use… May 17, 2026 at 9:15 am
  • added an answer This is exactly how the Skyhook database (built into many… May 17, 2026 at 9:15 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.