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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:29:00+00:00 2026-05-21T15:29:00+00:00

I have some Core Data entries which are all fetched and thrown into an

  • 0

I have some Core Data entries which are all fetched and thrown into an array when the application starts up.
When I delete an object from Core Data using deleteObject: I refresh this array by reading all Core Data entries again and throw them into the array. Here, the Core Data object is correctly deleted and is not loaded into the new array. But when I launch the application again, the entries are not removed. They are loaded again.

Does anyone have an idea why my Core Data objects are not correctly removed?

This is where I delete an object:

// Define our table/entity to use  
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Notes" inManagedObjectContext:managedObjectContext];

// Setup the fetch request  
NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setEntity:entity];

// Fetch the records and handle an error  
NSError *error;  
NSMutableArray *allNotes = [[NSMutableArray alloc] initWithArray:[[managedObjectContext executeFetchRequest:request error:&error] mutableCopy]];

for(int i = 0; i < [allNotes count]; i++) {
    if([[allNotes objectAtIndex:i] identifier] == [[note objectAtIndex:0] identifier]) {
        [managedObjectContext deleteObject:[allNotes objectAtIndex:i]];
        NSLog(@"DELETING..");
        NSLog(@"%@", [allNotes objectAtIndex:i]);
    }
}

[request release];

This is how I set the array of Core Data entries on start up

// Define our table/entity to use  
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"Notes" inManagedObjectContext:managedObjectContext_];

    // Setup the fetch request  
    NSFetchRequest *request = [[NSFetchRequest alloc] init];
    [request setEntity:entity];

    // Fetch the records and handle an error  
    NSError *error;  
    globalNotes = [[NSMutableArray alloc] initWithArray:[[managedObjectContext_ executeFetchRequest:request error:&error] mutableCopy]];

    [request release];

    NSLog(@"NOTES ON STARTUP");
    NSLog(@"%@", globalNotes);

Here is some data which I print using NSLog. This might help solving the issue and will show, that these notes are deleted but reappers.

2011-04-25 20:11:40.877 Caltio[4039:707] NOTES ON STARTUP
2011-04-25 20:11:40.888 Caltio[4039:707] (
    "<Notes: 0x1855d0> (entity: Notes; id: 0x184cd0 <x-coredata://DC8B3294-6D87-4236-9E5C-29E11F7330FA/Notes/p2> ; data: <fault>)",
    "<Notes: 0x1858b0> (entity: Notes; id: 0x184ce0 <x-coredata://DC8B3294-6D87-4236-9E5C-29E11F7330FA/Notes/p3> ; data: <fault>)"
)
2011-04-25 20:16:41.561 Caltio[4039:707] DELETING..
2011-04-25 20:16:41.569 Caltio[4039:707] <Notes: 0x1855d0> (entity: Notes; id: 0x184cd0 <x-coredata://DC8B3294-6D87-4236-9E5C-29E11F7330FA/Notes/p2> ; data: {
    added = "2011-04-25 17:56:15 +0000";
    identifier = 2567446185;
    note = Test;
    updated = 0;
})
2011-04-25 20:16:41.589 Caltio[4039:707] NOTES AFTER REFRESH:
2011-04-25 20:16:41.595 Caltio[4039:707] (
    "<Notes: 0x1858b0> (entity: Notes; id: 0x184ce0 <x-coredata://DC8B3294-6D87-4236-9E5C-29E11F7330FA/Notes/p3> ; data: {\n    added = \"2011-04-25 17:57:26 +0000\";\n    identifier = 2567446127;\n    note = Test;\n    updated = 0;\n})"
)

2011-04-25 20:17:05.103 Caltio[4052:707] NOTES ON STARTUP
2011-04-25 20:17:05.115 Caltio[4052:707] (
    "<Notes: 0x1bee60> (entity: Notes; id: 0x1be570 <x-coredata://DC8B3294-6D87-4236-9E5C-29E11F7330FA/Notes/p2> ; data: <fault>)",
    "<Notes: 0x1bf150> (entity: Notes; id: 0x1bdcd0 <x-coredata://DC8B3294-6D87-4236-9E5C-29E11F7330FA/Notes/p3> ; data: <fault>)"
)
  • 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-21T15:29:00+00:00Added an answer on May 21, 2026 at 3:29 pm

    Do you save your managedObjectContext? As I understand it, adding, amending and deleting objects only really affects their in-memory representation. You also need to save the context to persist it.

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

Sidebar

Related Questions

I have some ASP.NET web services which all share a common helper class they
My situation is simple: I have some records in my core data store. One
I have some questions about multi-threaded programming and multi-core usage. In particular I'm wondering
I have a quad core machine and would like to write some code to
We have some input data that sometimes appears with &nbsp characters on the end.
I have some C# / asp.net code I inherited which has a textbox which
I have some kind of test data and want to create a unit test
Basically I have three different Core Data entities ( A , B , C
I have some model classes which I wanted to store with the CoreData framework.
I have some UI in VB 2005 that looks great in XP Style, but

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.