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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:44:36+00:00 2026-05-23T10:44:36+00:00

I am referring to the following question: Delete/Reset all entries in Core Data? Sometimes

  • 0

I am referring to the following question: Delete/Reset all entries in Core Data?

Sometimes upon startup, I would like to clear out my Core-Data database and re-download it all over again. I am just starting to use Core Data so I am a beginner in Core Data.

1) The answers shows:

NSPersistentStore *store = ...;

How would I get the NSPersistentStore? My App Delegate does not refer to the NSPersistentStore, only to the NSStorePersistentCoordinator.

2) Am I supposed to rebuild the stack after I run the following (in the answer)?

NSPersistentStore *store = ...;
NSError *error;
NSURL *storeURL = store.URL;
NSPersistentStoreCoordinator *storeCoordinator = ...;
[storeCoordinator removePersistentStore:store error:&error];
[[NSFileManager defaultManager] removeItemAtPath:storeURL.path error:&error];

If so, how do I rebuild the stack? Can I just call one function to do that?

Thanks,

  • 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-23T10:44:37+00:00Added an answer on May 23, 2026 at 10:44 am

    Why you want to use NSPersistentStore ?? Just because of that post ? If yes then i recommend you to go with `NSManagedObject. You can simply delete all your core data through a fetch request and then have a for loop on it. Its old approch but its easy to understand for beginners. This might help you:

    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
    NSEntityDescription *entity = 
    [NSEntityDescription entityForName:entityDescription inManagedObjectContext:managedObjectContext];
    
    [fetchRequest setEntity:entity];
    
    NSError *error;
    NSArray *items = [managedObjectContext executeFetchRequest:fetchRequest error:&error];
    [fetchRequest release];
    
    
    for (NSManagedObject *managedObject in items) {
        [managedObjectContext deleteObject:managedObject];
    
    }
    if (![managedObjectContext save:&error]) {
    
    }
    

    Happy Coding..!

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

Sidebar

Related Questions

Referring to this question, let's say we have the following scenario - A model
Suppose i want something simple like the following: I have an core-algorithm, which randomly
Referring to question Spring Autowiring stopped working on GAE I ask: why doesn't AppEngine
Referring to the other question I asked Django using AJAX with Forms, Views ,
Referring to Brian Goetz's article Are all stateful Web applications broken? for IBM developerWorks,
Referring to this question , how can i get the current page size in
referring to this question , I've decided to duplicate the tables every year, creating
This question made me question a practice I had been following for years. For
This sounds like a relatively simple question, but I haven't been able to get
Referring to the discussion performSelector where is explained that with the following line it

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.