可可,恢复文档时出错
当尝试在基于文档的应用程序中恢复文档版本时,出现错误:
kCGErrorFailure:CGSDisplayID:应用程序尝试枚举 [0 到 CGSGetNumberOfDisplays()],而不是使用 CGSGetDisplayList()。补偿...
kCGErrorFailure:设置断点 @ CGErrorBreakpoint() 以捕获记录的错误。
并且该文件保持不变。另外,当发生这种情况时,我一开始编辑文档就会收到一条消息,告诉我:
无法自动保存文档[...]。该文件已被另一个应用程序更改。
我认为这两个问题可能是相关的。
我不知道该怎么做或“检查”,因为版本不需要任何实现就可以工作;我实际上很困惑,因为苹果说我只需要启用自动保存即可恢复/恢复使用版本。有谁知道什么可能导致该错误?
谢谢。
When trying to restore a version of a document in my document based application, I get an error:
kCGErrorFailure: CGSDisplayID: App trying to enumerate [0 to CGSGetNumberOfDisplays()] instead of using CGSGetDisplayList(). Compensating...
kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
and the document remains unchanged. Also, when this happens, I get a message as soon as I start editing the document telling me:
The document [...] could not be autosaved. The file has been changed by another application.
I think these two problems may be related.
I don't know what to do or "check" because versions just works without any implementation needed; I'm actually confused, because Apple says that I just need to enable autosave in order to restore/revert using versions. Does anyone know what can be causing that error?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了你所有的问题,让我很痛苦。
我之前在浏览版本时也收到过有关 kCGErrorFailure... 的错误消息。我只是忽略了它,因为它对我来说似乎无害。 TextEdit 似乎也吐出此消息。 (看起来像苹果的错误)
对于“文档保持不变”,请检查此处:从 OSX lion 上的版本浏览器恢复不起作用...想法?(简而言之,用于更新文档的代码正在恢复的文档可能不会调用 UI)(在我看来没有记录)
有关自动保存问题,请在此处检查:http://www.cocoabuilder.com/archive/cocoa/306217-how-to-implement-auto saving-browsing-versions-reverting-to-last-saved-in-lion.html(在简而言之,使用文件包装器方法来读取和写入)。 (看起来像苹果的bug)
I've ran into all of your issues, causing me much pain.
I've gotten that error message regarding kCGErrorFailure... before as well when browsing versions. I've just ignored it mostly as it seems harmless to me. TextEdit seems to spit out this message as well. (Looks like an Apple bug)
For the "document remains unchanged", check here: Restoring from versions browser on OSX lion not working... ideas? (in short, your code for updating your document's UI is probably not being called for the document that is being reverted) (Looks undocumented to me)
For autosaving issues, check here: http://www.cocoabuilder.com/archive/cocoa/306217-how-to-implement-autosaving-browsing-versions-reverting-to-last-saved-in-lion.html (in short, use the file wrapper methods instead for reading and writing). (Looks like an Apple bug)
以及向 autosavesInPlace 返回 YES:您的文档至少需要调用 updateChangeCount:在发生更改时传递 NSChangeDone,以便它“知道”有要自动保存的更改。
As well as returning YES to autosavesInPlace: your document needs to at least call updateChangeCount: passing NSChangeDone whenever it changes, so that it "knows" that there are changes to be autosaved.