macosphotosframework

Getting full access to Photos Library on 10.13 or lower


I am trying to get full (read/write) access to the Photos Library - use case is I want to access the library, create/delete albums and move assets into/out of albums, as well as delete them from the library. I've already gone the MLMediaLibrary way, but in that case I can only get read access.

In the new 10.13 API the Photos package has been made available to OSX, however many of the functions are still only available for iOS per the documentation. In particular all findAsset functions are unavailable in OSX. In other words, I cannot find an entry point into the API to get PHAssets! I have tried looking into the MLMedia assets to see if there is a way to migrate the id into the Photos framework, to no avail. Could not find examples not relating to iOS either.

Any help appreciated! Ideally looking for a Swift solution, but open to Obj-C as well.

Thanks E.


Solution

  • The Photos framework is available on macOS only for restricted use cases:

    There's no support for using Photos / PhotosUI (aka PhotoKit) in macOS outside of these use cases. An app linking against Photos framework gets no access (not even read only access) to the user's Photos library.