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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:36:11+00:00 2026-06-05T07:36:11+00:00

I am trying to delete a Core Data Entity and no matter what delete

  • 0

I am trying to delete a Core Data Entity and no matter what delete rule I use, it just won’t work. It does not do anything at all.

I am using Firefox’s Sqlite Add-on to browse the core data database and I can see all the rows there after the delete code runs.

My code for deletion looks like this

+(void)deleteCustomerWithID:(int)customerid inManagedObjectContext:(NSManagedObjectContext  *)context
{
Customer *customer = nil;

NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"Customer"];
request.predicate = [NSPredicate predicateWithFormat:@"id = %d", customerid];
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"organization" ascending:YES];
request.sortDescriptors = [NSArray arrayWithObject:sortDescriptor];

NSError *error = nil;
NSArray *customers = [context executeFetchRequest:request error:&error];

if (!customers || ([customers count] > 1)) {
    // handle error
} else if (![customers count]) {
    // customer not found
} else {
    customer = [customers lastObject];
    [context deleteObject:customer];

    NSError *error; 
    if(![context save:&error]){
        NSLog(@"Unresolved error series %@, %@", error, [error userInfo]);
    }
}
}

Any ideas what am I doing wrong?

  • 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-06-05T07:36:12+00:00Added an answer on June 5, 2026 at 7:36 am

    I am not sure what went wrong but I ended up deleting all the relationships in Entities and then re-creating them. That seems to have solved the issue. I can now successfully Cascade Delete.

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

Sidebar

Related Questions

I am trying to delete part of a string that does not match my
Im trying to figure out right now all my core data is managed on
I am trying to delete the all but the most recent 3,000 items in
Unfortunately, while trying to delete previous core dumps, I set my core file size
I am a cocoa newbie trying to create an iPhone app including Core Data.
I am retrieving a fetch from my core data database and trying to iterate
I am trying to implement a Core Data backed UITableView that supports indexing (eg:
While trying to delete the data from my SQL Server CE 3.5 database, I
I am trying to set up the binding between Core Data, NSArraycountroller and a
I am getting intermittent and hard to track CoreData exceptions when trying to delete

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.