iphone - Core Data `deleteObject:` problem! -


i have following entities in core data shown in figure below. core data model

the delete rule relationship cascade.

questions: when ever delete 1 of entity object @ level 2 , [context save:&error]; other objects in table entity1 gets data fault , app crashes due not able read entity1 object more, giving exc_bad_access error.

i using 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 have never deleted object core data place problem occurring. can help.

thanks.
ps. have seen other questions on none has same kind of situation do.

edit:

my problem when try delete 1 object level 2 objects in entity1 getting data fault. thing 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>)"  ) 

from core data programming guide

if relationship delete rule cascade, deleting 1 object may result in deletion of others.

if don't want related objects deleted when delete given object, deletion rule relationships should other 'cascade'. want 'nullify' instead.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -