RHManagedObject icon indicating copy to clipboard operation
RHManagedObject copied to clipboard

deleteAllWithError does not delete an entity.

Open sakshiGoel26 opened this issue 8 years ago • 4 comments

We are facing an issue in our project, sometimes using "deleteAllWithError" for an entity doesn't delete it. Help will be appreciated.

sakshiGoel26 avatar Dec 30 '16 06:12 sakshiGoel26

Is it possible you're deleting the items in one thread and the items that persist are being managed and saved in another thread?

chriscdn avatar Jan 01 '17 15:01 chriscdn

@chriscdn I am saving & deleting items on main thread only. While deleting I am using "deleteAllWithError" method of RHMangedObject which internally uses "managedObjectContextForCurrentThreadWithError" method & saving process uses "managedObjectContextManager" method. Is this issue happening due to this?

sakshiGoel26 avatar Jan 03 '17 05:01 sakshiGoel26

Is this issue happening due to this?

I don't think so. In the end both methods use the NSManagedObjectContext for the current thread, which is the same if you're doing this all from the same thread. Something else to check: Can you confirm the items not being deleted have actually been saved?

chriscdn avatar Jan 03 '17 20:01 chriscdn

Issue resolved. Reason was, after deleting an entity we were not using "commit" for that entity. Thanks.

sakshiGoel26 avatar Jan 17 '17 07:01 sakshiGoel26