Is there any uptodate guide, article, sample code on NSPersistentDocument?
I have multiple nsmanagedobject contexts and so I need to overwrite the read and write functions of NSPersistentDocument. Things have changed substantially in the last few years and it's not clear when steps have to be taken in the various functions.
The revertToContentsOfURL is most puzzling. Are you supposed to remove and re-add the persistent store or just reset the context?
Can a file just be moved by cocoa without affecting the persistent store (SQLite) and coordinators? The document file is basically the persistent store file, so I am worried the database is going to get yanked out from under me.
I have multiple nsmanagedobject contexts and so I need to overwrite the read and write functions of NSPersistentDocument. Things have changed substantially in the last few years and it's not clear when steps have to be taken in the various functions.
Code:
func readFromURL(absoluteURL: NSURL, ofType typeName: FileType) throws
func writeToURL(absoluteURL: NSURL, ofType typeName: FileType, forSaveOperation saveOperation: NSSaveOperationType, originalContentsURL absoluteOriginalContentsURL: NSURL?) throws
func revertToContentsOfURL(url: NSURL, ofType typeName: String) throws
Can a file just be moved by cocoa without affecting the persistent store (SQLite) and coordinators? The document file is basically the persistent store file, so I am worried the database is going to get yanked out from under me.
Last edited by a moderator: