Re: Still can't delete CoreData object
Re: Still can't delete CoreData object
- Subject: Re: Still can't delete CoreData object
- From: Rick Mann <email@hidden>
- Date: Tue, 25 Jun 2013 15:36:18 -0700
A bit of additional info:
The only job I can't delete is my "active" job. I keep a strong reference to that object in a view controller. I have that view controller set up to listen for changes to the MOC, and to forget that active object if it is deleted, but this seems to be what's causing the problem.
If I first set that reference to nil, and THEN delete the object, I don't get the problem.
But this clutters my delete code; I'd rather just watch for changes to the MOC. Is that unreasonable?
On Jun 25, 2013, at 15:30 , Rick Mann <email@hidden> wrote:
> I have a situation in which I can't delete one of my core data objects from a UITableView. The list is built using NSFetchedResultsController, and I delete the objects after the user swipes to delete with
>
> Job* obj = [self.resultsController objectAtIndexPath: inIndexPath];
> [obj.managedObjectContext deleteObject: obj];
>
> I then save the MOC.
>
> My -controller:didChangeObject:atIndexPath:forChangeType:newIndexPath: delegate method gets called with NSFetchedResultsChangeDelete, and I call
>
> [self.tableView deleteRowsAtIndexPaths: @[ inIndexPath ] withRowAnimation: UITableViewRowAnimationAutomatic];
>
> But then, as part of the same MOC -save: call, it gets a NSFetchedResultsChangeInsert. Interestingly, the address of the object inserted is the same as the address of the object that was just deleted, as is its x-coredata URI, but all of its properties have default values.
>
> If I then try to delete the object again, it's data is <fault>, and the MOC -save method returns false, but no NSError is returned.
>
> Any ideas?
>
>
> --
> Rick
>
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
Rick
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden