swift - MacOs应用程序-添加到查找程序上下文菜单?

时间:2021-10-14 21:20:08

Before all, I'm very new in swift cocoa application.

首先,我对swift cocoa应用程序非常陌生。

I'm developing an MacOS application for my company, the goal of this is to open a file ("right-click -> open with my app") to process it.

我正在为我的公司开发一个MacOS应用程序,它的目标是打开一个文件(“用我的应用程序右键单击->打开”)来处理它。

But after couples of search, I'm not enable to find a way to do it. (I probably didn't search the good terms, but like I said I'm very new to this)

但经过几对夫妇的搜索,我无法找到一种方法。(我可能找不到合适的词,但就像我说的,我对这个很陌生)

(I've done a similar things to windows, using the registers)

(我使用注册表对windows做了类似的操作)

Somebody has an idea? link, documentation ?

有人有一个想法?链接、文档吗?

Thanks !

谢谢!

1 个解决方案

#1


1  

Please have a look at Document based applications. It is a huge topic: https://developer.apple.com/library/mac/documentation/DataManagement/Conceptual/DocBasedAppProgrammingGuideForOSX/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011179-CH1-SW1

请查看基于文档的应用程序。这是一个非常大的主题:https://developer.apple.com/library/mac/documentation/datamanagement/conceptual/docbasedappprogrammingguideforosx/tion/tion.html #//apple_ref/doc/uid/TP40011179-CH1-SW1。

As soon you register for types of documents you app can open, this feature will work the same way as in Windows. I.e. if you register custom extension, you app will onep this file by default. If you specify lets say you app can open pictures, it will show up in "open with" right click popup menu.

一旦你注册了你的应用程序可以打开的文件类型,这个功能就会像Windows一样工作。也就是说,如果你注册了自定义扩展名,你的应用会在默认情况下登录这个文件。如果你指定让你的应用可以打开图片,它会显示在“打开与”右键弹出菜单中。

Pay attention to document types registration. Here is an example from one of the books (Learning Swift 2016):

注意文件类型登记。以下是其中一本书(《学习Swift 2016》)中的一个例子:

swift - MacOs应用程序-添加到查找程序上下文菜单?

#1


1  

Please have a look at Document based applications. It is a huge topic: https://developer.apple.com/library/mac/documentation/DataManagement/Conceptual/DocBasedAppProgrammingGuideForOSX/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011179-CH1-SW1

请查看基于文档的应用程序。这是一个非常大的主题:https://developer.apple.com/library/mac/documentation/datamanagement/conceptual/docbasedappprogrammingguideforosx/tion/tion.html #//apple_ref/doc/uid/TP40011179-CH1-SW1。

As soon you register for types of documents you app can open, this feature will work the same way as in Windows. I.e. if you register custom extension, you app will onep this file by default. If you specify lets say you app can open pictures, it will show up in "open with" right click popup menu.

一旦你注册了你的应用程序可以打开的文件类型,这个功能就会像Windows一样工作。也就是说,如果你注册了自定义扩展名,你的应用会在默认情况下登录这个文件。如果你指定让你的应用可以打开图片,它会显示在“打开与”右键弹出菜单中。

Pay attention to document types registration. Here is an example from one of the books (Learning Swift 2016):

注意文件类型登记。以下是其中一本书(《学习Swift 2016》)中的一个例子:

swift - MacOs应用程序-添加到查找程序上下文菜单?