NSFilePresenter -presentedSubitemDidAppearAtURL:方法永远不会被调用 [英] NSFilePresenter -presentedSubitemDidAppearAtURL: method never gets called
问题描述
我有一个符合NSFilePresenter协议的对象,它表示我的基于文档的应用程序文档包。当在包内创建一个新文件时,使用带有正确NSFileCoordination方法的NSFileManager或者通过Finder i只能得到 -presentedSubitemDidChangeAtURL:
事件,但在这种情况下似乎不那么明显 -presentedSubitemDidAppearAtURL:
。
I have an object which conforms to NSFilePresenter protocol that represents my document-based application document package. When a new file is created inside the package, either programmatically using NSFileManager with proper NSFileCoordination methods or via Finder i only got -presentedSubitemDidChangeAtURL:
event, but not seeming so obvious in this case -presentedSubitemDidAppearAtURL:
.
这是一个预期的行为还是我做错了?
Is this an expected behavior or i am doing something wrong?
在NSFilePresenter状态中 -presentedSubitemDidAppearAtURL:
的注释:
The comments on -presentedSubitemDidAppearAtURL:
in NSFilePresenter state it clear:
通知目录中包含的文件或目录已添加。如果这个方法没有实现,但
-presentedItemDidChange
是,并且该目录实际上是一个文件包,那么文件协调机制将调用-presentedItemDidChange
。
Be notified that a file or directory contained by the directory has been added. If this method is not implemented but
-presentedItemDidChange
is, and the directory is actually a file package, then the file coordination machinery will invoke-presentedItemDidChange
instead.
推荐答案
,我打开了一个与苹果的技术支持问题。他们的回答是,这是一个错误,我们现在唯一能做的就是通过 -presentedSubitemDidChangeAtURL:
。
After struggling with this exact issue for quite a while, I opened a technical support issue with Apple. Their response was that this is a bug, and the only thing we can do right now is to do everything through -presentedSubitemDidChangeAtURL:
.
我鼓励任何遇到此问题的人提出错误( https://bugreport.apple.com ),鼓励苹果以尽快解决此问题。
I would encourage anyone encountering this issue to file a bug (https://bugreport.apple.com) to encourage Apple to get this problem fixed as soon as possible.
这篇关于NSFilePresenter -presentedSubitemDidAppearAtURL:方法永远不会被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!