8

We have a shoebox-style application that we want to make a first-class citizen in Lion. This means integrating Auto-Save & Versions among other things. Currently we don’t have a document-centric model and we just use a plain Core Data stack.

UIPersistentDocument provides a really easy way to integrate both Auto-Save & Versions and I see two options we could choose from to integrate with the new APIs:

  1. “Abuse” NSPersistentDocument for our shoebox-style application. Technically it would be a document-based application, but the user interface would still be the same iPhoto-like library. This makes conceptually not a lot of sense, but we would get a lot of functionality for free.
  2. Keep the current plain Core Data stack and implement Auto-Save & Versions manually.

I heard contradicting opinions from Apple representatives about the approach we should take and it would be great to clarify things before we start our implementation. While I think that 1. shouldn’t be used it’s also very tempting, because we get a lot for free. I couldn’t even find sufficient documentation on manually implementing Auto-Save & Versions in a Core Data application.

I would really tend to use 1. but I see some problems:

  • I’m worried about file-system-level conflicts when using versions and only one database-file. I couldn’t find any documentation regarding this topic.
  • I’m worried about performance issues in Versions when browsing through “space”.
  • We can’t enforce only one instance of the open database, since Versions has to open several instances. I’m worried about side-effects and concurrency issues. Conceptually it looks like a hack and I don’t like hacks.

If we would only want to integrate iCloud sync I definitely wouldn’t think about using a document-centric model for our application, because Core Data supports it directly. I’m mostly worried about the developer overhead we would have if we would stick to our current non-document based paradigm.

Do you have any advice or ideas how shoebox applications should be integrated in the new Lion world?

4

1 回答 1

3

恐怕你被迫使用第一个选项。版本是在 NSDocumentController *sic* 中实现的,因此您将不得不使用某种形式NSDocument从版本中获取任何内容。我认为您还必须将您的应用程序窗口添加NSWindowController到该文档中,以便在顶部获得漂亮的小弹出菜单。问题是版本或多或少是一个完全不透明的功能......

但是您必须自己回答一个问题:您希望将应用程序的哪些部分放入版本中?在恢复数据时,将所有内容都放在一个文件中真的有意义吗?版本恢复(复制和粘贴除外)发生在文件系统级别。因此,总是立即恢复所有内容真的有意义吗?如果您的答案是否定的,您甚至可能不得不将您的模型分割成多个较小的文件...

在下一个主要版本之前不要指望这里的改进。这就是我从工程师的评论中猜到的......

于 2011-07-31T15:41:01.930 回答