文件应用程序中的 Apple FileProvider 扩展从文档浏览器的上下文菜单操作中删除复制、复制操作 [英] Apple FileProvider extention in File Application remove Copy, Duplicate operation from document browser's context menu action

查看:15
本文介绍了文件应用程序中的 Apple FileProvider 扩展从文档浏览器的上下文菜单操作中删除复制、复制操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从文档浏览器的上下文菜单操作中删除复制、复制操作在我的 FileProviderItem 类代码中修改属性 capabilities

class FileProviderItem: NSObject, NSFileProviderItem {var 能力:NSFileProviderItemCapabilities {返回允许阅读}}

通过使用上面的代码,我可以从文档浏览器的上下文菜单操作中删除移动、删除操作.

有没有办法从文档浏览器的上下文菜单操作中删除复制、复制操作?

解决方案

只是为了在评论中发布我对您说的话,这种行为是由文件提供程序扩展 UI 定义的.将文件提供程序扩展添加到应用程序时,它会在您的应用程序目标中添加两个目标.如果您不想要这种类型的功能,那么只需从您的项目中删除文件提供程序扩展 UI 目标即可.

以下是 Apple 在 File Provider Extension UI 上的摘录:

<块引用>

使用文件提供程序 UI 扩展向您的文件添加自定义操作提供者扩展.如果用户长按一个浏览文件提供商的内容时的项目.当用户选择您的操作,系统会显示您的自定义用户界面,用户完成操作的地方.用户完成后,您必须明确取消或完成操作.

I want to remove Copy, Duplicate operation from document browser's context menu action In my code for class FileProviderItem modify property capabilities

class FileProviderItem: NSObject, NSFileProviderItem {

    var capabilities: NSFileProviderItemCapabilities {
        return allowsReading
    }
}

By using above code i can remove Move,Delete operation from document browser's context menu action.

Is there any way to remove Copy, Duplicate operation from document browser's context menu action?

解决方案

Just to also post what I said to you in the comments, this behavior is defined by the file provider extension UI. When adding the file provider extension to the application, it adds two targets in your apps targets. If you don't want this type of functionality, then simply just remove the file provider extension UI target from your project.

Here's an excerpt from Apple on the File Provider Extension UI:

Use the File Provider UI extension to add custom actions to your File Provider extension. These actions appear if the user long presses an item while browsing your file provider's content. When the user selects your action, the system displays your custom user interface, where the user completes the action. After the user is finished, you must explicitly cancel or complete the action.

https://developer.apple.com/documentation/fileproviderui

这篇关于文件应用程序中的 Apple FileProvider 扩展从文档浏览器的上下文菜单操作中删除复制、复制操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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