Apple FileProvider extention in File Application remove Copy, Duplicate operation from document browser's context menu action

笑着哭i 提交于 2019-11-28 12:00:41

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/48783317/apple-fileprovider-extention-in-file-application-remove-copy-duplicate-operatio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!