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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:18:01+00:00 2026-05-21T10:18:01+00:00

I have the following entities in core data as shown in the figure below.

  • 0

I have the following entities in core data as shown in the figure below.
Core Data Model

The delete rule for all the relationship is cascade.

Questions:
When ever i delete the any one of the entity object at level 2 and do [context save:&error]; all other objects in Table Entity1 gets the data fault and the app crashes due to not able to read the Entity1 object any more, giving EXC_BAD_ACCESS error.

I am using this code

for(Entity1 *entity in listOfEntitys)
{
    if(entity.Relation1)
        [context deleteObject:entity.Relation1];

    if(entity.Relation2)
        [context deleteObject:entity.Relation2];

    if(entity.Relation3)
        [context deleteObject:entity.Relation3];
}
[context save:&error];

Its not like I have never deleted any object from core data but this is the only place where problem is occurring. Can anyone Help.

Thanks.
PS. I have seen other questions on SO but none has the same kind of situation as i do.

Edit:

My problem is that when I try to delete any one object from level 2 then all the objects in the entity1 are getting data fault. some thing like this.

Printing description of listOfEntitys: 
(
    "<Entity1: 0x4dc3d80> (entity: Entity1; id: 0x4dc2d60 <x-coredata://DF11191D-0BE9-4A63-955D-0A43153290A4/Entity1/p5> ; data: <fault>)",
    "<Entity1: 0x5b06ea0> (entity: Entity1; id: 0x5b077d0 <x-coredata://DF11191D-0BE9-4A63-955D-0A43153290A4/Entity1/p6> ; data: <fault>)",
    "<Entity1: 0x4dc2cf0> (entity: Entity1; id: 0x4dc2df0 <x-coredata://DF11191D-0BE9-4A63-955D-0A43153290A4/Entity1/p7> ; data: <fault>)",
    "<Entity1: 0x4dc2b80> (entity: Entity1; id: 0x4dc3640 <x-coredata://DF11191D-0BE9-4A63-955D-0A43153290A4/Entity1/p8> ; data: <fault>)" 
)
  • 1 1 Answer
  • 1 View
  • 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-21T10:18:01+00:00Added an answer on May 21, 2026 at 10:18 am

    From the Core Data Programming Guide

    If a relationship delete rule is
    Cascade, then deleting one object may
    result in the deletion of others.

    If you don’t want related objects to be deleted when you delete a given object, then the deletion rule for those relationships should be something other than ‘cascade’. You probably want ‘nullify’ instead.

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

Sidebar

Related Questions

So I have the following code for fetching all of my core data entities
I have the following core data model with two entities: entity item which holds
Consider that i have two entities with following relationship: Entity A <-->> Entity B
I have a core data stack with 2 entities: 'Client' and 'Car'. It is
I have a core data based app that manages a bunch of entities. I'm
I have a Core Data store which contains a number of MediaItem entities that
I have three core data entities which I am importing into, they are: •
I have 2 entities in my Core Data database Person and Photo a Person
I am creating an iOS 5 app using Core Data. I have two entities
Possible Duplicate: Does every Core Data Relationship have to have an Inverse? I am

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.