Hello @joadan, I made the sample as is to illustrate that may be the user will touch the mainContext to delete objects (by touching a user interface) even if a ModelActor exists. But may be that’s another topic.
I update my sample and just tried using modelContext in delete and removing @MainActor but as you guess, still crashing. However manually clearing the self._rooms property (~= deleteV1) or even setting explicitly nil the home property of my rooms before deleting, avoid the crash.
When you say « you have a reference to the deleted objects in self._rooms that you need to clear before doing the delete. »
This seems to be obvious to you can you detail a bit ? I guess this is pretty common scenario where an object like a view retain some models.
Why does keeping a reference to homes is ok, rooms ok but both leads to a crash?
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: