I am trying to sync CoreData
between iOS 9.0 and watchOS 2.0. My database is pretty small, so I wanted to just send the entire file over using the file transfer in watch connectivity. I know I need to find the URL of the CoreData
stack and send that along with the metadata. I think I am getting the URL correctly, but I am getting a null error for the metadata. This is what I have tried.
let bundle = NSBundle.mainBundle()
let modelURL = bundle.URLForResource("Sunday", withExtension: "momd")!
do {
let myStore = try NSPersistentStoreCoordinator.metadataForPersistentStoreOfType(nil, URL: modelURL)
let fileTransfer = WCSession.defaultSession().transferFile(modelURL, metadata:myStore)
catch {
}
The metadata argument is not required and can be nil, which in your case I think will be fine. Give that a shot
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments