Failed to execute select query inside prepareForDeletion?

This is the same question as the warning; I had an error in my application in which I finally tracked the following: inside the prepareForDeletion some subclass of NSManagedObject I accessed the array that was created by request by executing a fetch request. If this array was already there when prepareForDeletion was called (and therefore when the selection request was not necessary) everything worked fine, but if the array was not loaded yet and the selection request was executed, it seemed that deleting the -about- object to-be-deleted was actually completed when the fetch was done, which makes it impossible to prepareForDeletion its task. However, I could not find anyone else complaining about this and not mention it in the documentation, so maybe this is something else. I am curious if anyone else has seen this behavior.

+6
source share
1 answer

I also came across this sort query execution behavior in prepareForDeletion. This is frustrating why this is happening. And also I found that prepareForDeletion will be called twice. The first time deleteObject: is called. The second time the save operation is performed.

0
source

Source: https://habr.com/ru/post/896243/


All Articles