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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:14:30+00:00 2026-05-25T10:14:30+00:00

Hi I do have a problem with my Core Data storage! I delete it

  • 0

Hi I do have a problem with my Core Data storage!
I delete it the following way like I found it here an stack overflow:

 NSFetchRequest * allFriends = [[NSFetchRequest alloc] init];
[allFriends setEntity:[NSEntityDescription entityForName:@"Friend" inManagedObjectContext:self.managedObjectContext]];
[allFriends setIncludesPropertyValues:NO]; //only fetch the managedObjectID

NSError * error = nil;
NSArray * friends = [self.managedObjectContext executeFetchRequest:allFriends error:&error];
[allFriends release];
//error handling goes here
for (NSManagedObject * Friend in friends) {
    [self.managedObjectContext deleteObject:Friend];
}

this seams to work perfect at runtime!
my tableview (which I manage with NSFetchedResultsController) clears and all is fine it looks!
Also when I hit the home button and start it back up it works.

BUT if I even close it from the multitasking list (so completely close it) and start it back up all is back in the tableView again!

could anybody help me out with this?

  • 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-25T10:14:30+00:00Added an answer on May 25, 2026 at 10:14 am

    Your code is fine but you have forgotten to commit all changes (objects were removed) made to database. So, you should add following lines to your code and after reopening the app your db will not contain that objects:

        NSError *error;
        if (![self.managedObjectContext save:&error]) 
        {
            // Update to handle the 
            NSLog(@"Unresolved error %@", error);
            exit(-1);  // Fail
        }
    

    Because all changes are stored in memory, don’t forget to save the managed object context after some important or critical changes were made. Before you commit your changes, the database/presistent-store file will be in the previously saved state.

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

Sidebar

Related Questions

Here's the core problem: I have a .NET application that is using COM interop
I have an iphone app that uses Core Data to do storage. I have
I have a problem with Core Data which has left me at the end
I think I have a problem, maybe linked to a retain cycle in Core-Data.
I'm currently facing in problem using Core Data. I have two entities A and
I have a problem with Core Data. The problem happens with this scenario :
I have a problem with my core data. I am trying to save the
I have a problem after the data being fetched from Core Data. I filled
I have a strange problem in my Core Data app. I have three entities
I have the following setup using Core Data: Nib1: A WindowController with two custom

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.