可可NSDocument:自动保存工作 [英] Cocoa NSDocument: getting autosave to work

查看:116
本文介绍了可可NSDocument:自动保存工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文档只是声明在共享doc控制器上将setAutosavingDelay设置为大于0的任何值,但是在调用

Documentation simply states that setting setAutosavingDelay to anything > 0 on the shared doc controller should do it, but after calling

[[NSDocumentController sharedDocumentController] setAutosavingDelay:2.0];

在我的控制器中,自动保存似乎无法正常工作:~/Library/Autosave Information/中我都看不到任何东西,

in my controller, autosave doesn't seem to work: I neither see anything in ~/Library/Autosave Information/, nor is

[[[NSDocumentController sharedDocumentController] currentDocument] autosavedContentsFileURL]

已初始化.

请注意,在我的应用中,正常的加载和保存工作正常(keyedarchivers,文档的基于nscoding的类等).

Note that in my app, normal loading and saving work fine (keyedarchivers, nscoding-based class for my docs, etc).

推荐答案

您是否已覆盖-updateChangeCount:呢?我可以肯定,Apple的实现是启动自动保存计时器的代码.另外,如果您尝试使用更长的计时器怎么办?

Have you overridden -updateChangeCount: at all? I'm pretty certain that Apple's implementation is the code that starts up the autosave timer. Also, what if you experiment with a longer timer?

这篇关于可可NSDocument:自动保存工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆