We have three separate apps which are in same App Group and access the same CoreData store. Problem is that when I change something in item in NSOrderedSet
from relationship in managed object, save go to another app where refresh is performed, changed data are not there.
We are using NSPersistentContainer
and only one context in each app, container.newBackgroundContext()
saved to property in singleton. For each app when app goes to BG save()
is performed on that context and when app goes to FG refreshAllObjects()
is called on the context.
When I change some basic attribute in managed object it is changed properly in another app. But when I change some property in item from NSSet which is a relationship on managed object this change is not visible in another app.
While I was debugging I tried to call fetch but it also provides only old data. Only when I called context.reset()
and then fetch again it returns valid new data.
Problem is that I cannot use reset on whole context because I will lose all registered objects in app.
Is this valid behavior or bug that referenced objects changes are not applied when refreshAllObjects()
is used?
Is there any way how to force fetch request to get data directly from the database and not cached one from context?