I have an app with a CoreData database and access it using UIManagedDocument
.
To share the data with the Watchkit
app, I'm moving the database to a shared App Group.
The store is created correctly it seems, but after that it often becomes impossible to access it: the UIManagedDocument
keeps trying to reconfigure the store, and NSFileManager
doesn't find the file (with fileExistsAtPath
).
The problem is in the database location - if I save it in the documents directory instead of the shared Group, it works without trouble. It's also not a problem of accessing it from both apps, even if I don't open the watch app at all the problem appears. The group is also working correctly for sharing NSUserDefaults
.
Did anyone see similar problems? Is there any locking mechanism that I need to deal with in a specific way? Any help will be greatly appreciated, I've been struggling a lot with this issue!