Reputation: 1
[request2 setEntity:entity];
NSPredicate * predicate2 = [ NSPredicate predicateWithFormat:@"logoFrameNum == %@",[NSNumber numberWithInt:7]];
[request2 setPredicate:predicate2];
NSManagedObject * collectionList2 = [[ managedObjectContext executeFetchRequest:request2 error:&error2] objectAtIndex:0];
NSLog(@"context :%@", deleteContext1);
[managedObjectContext deleteObject:collectionList2];
BOOL yesorno = [collectionList2 isDeleted];
NSLog(@"yesorno : %i", yesorno);
NSError * error10;
NSLog(@"[managedObjectContext ] : %@", deleteContext1);
[collectionList2 release];
if (![managedObjectContext save:&error10]) {
// Update to handle the error appropriately.
NSLog(@"Unresolved error %@, %@", error10, [error userInfo]);
exit(-1); // Fail
}
There is much more source above it. Change variables or get data from coredata is well performed with the same NSManagedObjectContex I have there. However delete with that context makes me crazy. It crashes without any error message just in
if (![managedObjectContext save:&error10]) {
I tried get a new context and so on and on........a lot..
Upvotes: 0
Views: 180
Reputation: 6508
You are performing a release
on an object (collectionList2
) that you don't own. This may cause a crash later on (for example, during the save). Try removing the release
.
Upvotes: 1
Reputation: 80265
Maybe you are trying to delete a nil
object.
Also, you should do all this within one single NSManagedObjectContext
.
Try putting your save:error:
method right below the deleteObject:
call.
Upvotes: 0