Register an application to open image files

I successfully registered my application for opening PDF files by including the following in my info.plist:

<key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeName</key> <string>PDF</string> <key>LSHandlerRank</key> <string>Alternate</string> <key>LSItemContentTypes</key> <array> <string>com.adobe.pdf</string> </array> </dict> </array> 

However, I can not register my application to open any image files, I tried to register not only for the base UTI image, but also for specific types, such as png and jpg. Is it possible to register to open image files?

+2
source share
3 answers

The bad news is that it cannot be done. The desire for these things will be indicated in the documents.

+2
source

open the plist with the source code and add this for the document.

 <dict> <key>CFBundleTypeName</key> <string>All Files</string> <key>CFBundleTypeIconFiles</key> <array/> <key>LSItemContentTypes</key> <array> <string>public.data</string> <string>public.content</string> </array> <key>CFBundleTypeRole</key> <string>Editor</string> <key>LSHandlerRank</key> <string>Owner</string> </dict> 

I hope this will be helpful to you.

+1
source

Open plist using the editor ...

Capitalization, etc. is critical, it is recommended to specify both lowercase and upper file extensions.

 <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeExtensions</key> <array> <string>jpg</string> <string>JPG</string> </array> <key>CFBundleTypeName</key> <string>Images</string> <key>CFBundleTypeRole</key> <string>Editor</string> 

Then save the file. The application should now be registered to process this type of file.

-1
source

Source: https://habr.com/ru/post/954572/


All Articles