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

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

问题描述



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

  class FileProviderItem:NSObject,NSFileProviderItem {

var capabilities:NSFileProviderItemCapabilities {
return allowsReading
}
}

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



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

解决方案

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



以下是Apple在文件提供程序扩展上的摘录UI:


使用文件提供程序UI扩展将自定义操作添加到File
Provider扩展。如果用户在浏览文件提供程序的内容时长按
项,则会显示这些操作。当用户
选择您的操作时,系统会显示您的自定义用户界面
,其中用户完成操作。用户完成后,
必须明确取消或完成操作。



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天全站免登陆