Core Data not persisting between launches

While running my watchOS 2 app in the simular, when I save objects to my core data store, they *do* appear in a table when I do a fetch.


However, when I launch the app again, the store appears to be empty (fetch returns 0 objects).


I have verified that the object is being saved as no error is thrown:

            try coordinator.managedObjectContext.save()


Coordinator here is my CoreData stack that I pass among my page views (not a singleton).


Has anyone seen this behavior with CoreData and the simulator?


Thanks

Curious, is the CoreData accessed in the WatchKit Extension? I have yet to implement CoreData for my persisted data but have not implemented it yet.


I am working on an App that grabs data from an internet API call, then adds the data to CLKComplicationTimelineEntry for the complication data. A good pattern to persist the CLKComplicationTimelineEntry would be helpful rather that making an expensive network call every hour.

This occurred to me too just after I posted this. My Core Data stack is created in my WatchKit Extension.


Am I suppose to create it in the WatchKit App and access with a shared group? (I am about to go try and find this information)

So stupid me: I changed my CoreData stack from watchOS 1 to watchOS 2. My main context was saving properly, but I was not then saving the changes on the parent context.


So yes: Core Data can be persisted on the extension.


How many CLKComplicationTimelineEntries do you plan on having?

Are you using core data for both the watch and the phone?

I am currently trying to figure out how to keep the database sync'd up across both the phone and watch and can't seem to find any information on how to do that since we're not supposed to use shared groups for watchOS 2.

Core Data not persisting between launches
 
 
Q