NSFilePresenter

编程入门 行业动态 更新时间:2024-10-28 16:29:51
本文介绍了NSFilePresenter -presentedSubitemDidAppearAtURL:方法永远不会被调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个符合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:.

我鼓励任何遇到此问题的人提出错误( bugreport.apple ),鼓励苹果以尽快解决此问题。

I would encourage anyone encountering this issue to file a bug (bugreport.apple) to encourage Apple to get this problem fixed as soon as possible.

更多推荐

NSFilePresenter

本文发布于:2023-11-08 09:43:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1569034.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NSFilePresenter

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!