Choosing an NSOpenPanel Constraint for the iPhoto Library

When using NSOpenPanel to open files, I try to allow users to select only iPhoto libraries. For example, the Aperture library has the extension .aplibrary. However, the iPhoto library does not have an extension.

For your information, the Aperture and iPhoto libraries are packages that will be completely correct. Aperture packages have the .aplibrary extension, while iPhoto packages do not seem to have the extension.

How can I let the user select iPhoto packages? Due to the lack of an extension, I cannot use "setAllowedFileTypes". However, iPhoto seems to be able to make a difference, but I do not see how this is done in this case.

+3
source share
1 answer

NSOpenPanelhas a delegate who needs to implement NSOpenSavePanelDelegate. One of the methods: -panel:shouldEnableURL:- if you implement this method, you can determine whether to allow anyone to open the location based on any logic you want.

+3
source

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


All Articles