Do I need to override the writing methods of NSDocument in subclasses for an application that will only be a viewer for files
I think I may be missing the obvious but I'm not sure.
The section on subclassing NSDocument in the docs states that subclasses of NSDocument must 开发者_JS百科override one reading and one writing method.
If I'm creating a viewer application that will not write anything back, do I still need to override a writing method (returning what, nil
?) or can I ignore it and make sure that there are no saving methods that can get called?
Given that the documentation says “must”, I’d say yes, write a do-nothing write method. Even if it works without one now, and there’s no obvious reason to break that, if it says “must” it’s entirely fair for AppKit to actually require it at some point in future.
精彩评论