在 OS X 谁拥有模型,NSDocument 或 NSViewController

In OS X who owns the model, NSDocument or NSViewController

在 iOS 工作 我从未处理过 OS 基于 X 和 NSDocument 的应用程序。模型引用应该存在于 NSDocument 内部还是 NSWindow 的内容 NSViewController 中的 representedObject 中?或者两者兼而有之?

它应该存储在 NSDocument 对象中,如 here 中的 Apple 文档所述。尤其要检查图 1-1。在下面的同一页上,Apple 声明 数据模型对应于文档类型 ,因此如果您有不同的模型,则应使用应存储在 NSDocument 对象中的不同文档类型。