Reasons behind Cocoa's error code 512 = NSFileWriteUnknownError

We are developing a document-based Objective-C project, using NSPersistentDocument and NSPersistentStore to save a unique binary file on disk. No autosave.

Our application sometimes throws NSFileWriteUnknownError when trying to save the document, but the error description is obviously vague as this is an "unknown" error, not allowing us to debug easily.

Why would such an unknown error be ever raised? Why doesn't Core Data know why it cannot save a file?

We build using SDK 10.14 and run on macOS Monterey 12.3.1

Most Cocoa errors include underlying error information in the user info dictionary, typically in the NSUnderlyingErrorKey property. Do you see anything there?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Reasons behind Cocoa's error code 512 = NSFileWriteUnknownError
 
 
Q