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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:26:12+00:00 2026-05-13T16:26:12+00:00

Please tell me: If I use Core Data in my iPhone app, I have

  • 0

Please tell me: If I use Core Data in my iPhone app, I have basically two files. The mydatamodel.xcdatamodel file, and then I need an .sqlite file. Apple provides this code snippet:

- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
    if (persistentStoreCoordinator != nil) {
        return persistentStoreCoordinator;
    }

    NSString *appDirPath = [self applicationDocumentsDirectory];
    NSString *storeFileName = @"mystore.sqlite";
    NSURL *storeUrl = [NSURL fileURLWithPath:[appDirPath stringByAppendingPathComponent:storeFileName]];

    NSError *error = nil;
    persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];

    if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:nil error:&error]) {
        NSLog(@"Error: %@, %@", error, [error userInfo]);
        abort();
    }

    return persistentStoreCoordinator;
}

Will this create the file if it’s not available already?

[persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:nil error:&error]

My app doesn’t need initial data, because it will download it when the user launches the app.

  • 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-13T16:26:12+00:00Added an answer on May 13, 2026 at 4:26 pm

    Yes, Core Data will create the SQLite db just after the first launch of your application in your app delegate.

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

Sidebar

Related Questions

Can i use XAMPP apache to compile my ASP files. If so, please tell
Please tell me what is use of: <add assembly=*/> because of this i am
Can anybody please tell me why should I use the NonAction attribute? I mean
Could someone please tell me how I can use find_by_attribute with a variable which
I am searching and searching. Please tell me is it possible to use menu
In my CMS contact-us page, I have the following code: {{block type=core/template name=contactForm form_action=/contacts/index/post
This question is in regards to UIView's -drawRect function. The Set-Up: My app consists
I have Some Passwords which contain some special and methimatical chracters like this password
New to stackoverflow, been very helpful searching, but alas the time has come to
Note: This question refers to a Rails project with Sass & Compass. Using 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.