Re: The Correct Place to Migrate my NSDocument
This works but it’s not right and throws a yucky messagetoggle quoted message Show quoted text
let holdDoc = try NSDocumentController.shared.openUntitledDocumentAndDisplay(false) as! Document
// set the updated data
holdDoc.documentQuestions = self.documentQuestions
// show the new document
throw NSError(domain: "Application", code: 1002, userInfo: [NSLocalizedDescriptionKey : "File Updated", NSLocalizedRecoverySuggestionErrorKey : "The new Untitled document has the information for " + (self.fileURL?.path)! ] )
From Apple’s - Additional Document Type Considerations
"If you want to automatically convert them to be saved as your new type, you can override the readFrom... methods in your NSDocument subclass to call super and then reset the filename and type afterwards. You should use setFileType: and setFileURL: to set an appropriate type and name for the new document. When setting the filename, make sure to strip the filename extension of the old type from the original filename, if it is there, and add the extension for the new type.”
But from NSDocument
"You cannot use this property to change the document’s format after it has already been opened or saved. This property records only the initial document format used when first opening or saving the file."
Call super what??? "Expected '.' or '[' after ‘super'"
On 12/05/2018, at 4:32 PM, Bill Pitcher <bill@...> wrote: