How to get all PHAssets from MacOS's Photo Library

浪尽此生 提交于 2019-12-06 03:10:53

The Photos framework — or at least, the main subset of that framework, which provides apps with read/write access to the entire Photos library — is not available in macOS.

Photos and PhotosUI are present in macOS, but only in support of specific app-extension features:

  • Photo Editing extensions. The user invokes these from the Photos app while in Edit mode for a single asset, and it provides direct access to the photo/video data for that asset, so it doesn’t even use the PHAsset class.
  • Photo Project extensions. These involve collections of assets and selectively loading data for each, so more of the PHAsset/PHImageManager system is present. However, it’s still a reduced subset compared to iOS (only what’s needed for a project extension, like fetching the assets in that project), and it’s accessible only to app extensions, not standalone apps.

If you’d like the full Photos framework on macOS, your best bet is to file a feature request with Apple.

As of macOS 10.15 Catalina, the Photos and PhotosUI frameworks are now available on the Mac, for both Catalyst and AppKit apps. So you should be able to transfer almost all iOS code that uses PhotoKit over to your Mac app now, as long as it has 10.15 as a minimum system requirement.

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