8

in iOS 14 beta, is there a way to check if the app has permissions to load a PHAsset image before trying to load it with PHImageManager.requestImage? This is for PHAuthorizationStatus.limited - when I fetch all assets in a PHAssetCollection, it returns those without permissions as well. I see an error object only when I try to load the image itself with PHImageManager.requestImage in the returned info object.

EDIT:

It turns out that this is a problem only on simulator. When I ran the app on a real device with iOS 14 beta, the PHAssetCollection fetch returned only those PHAssets that the user has granted access to.

elp
  • 8,021
  • 7
  • 61
  • 120
kzamanov
  • 81
  • 6

2 Answers2

0

Here are something I've tested on a real device:

You can have access to all the smart albums (in the form of PHAssetCollection) even if you are in Limited Photo Access mode. However, you can fetch assets from these collections only if a user has explicitly selected it. It's meaningless to have a collection without any assets available.

You can NOT have access to any user album in Limited Photo Access mode.

It behaves a little differently on a simulator as you can have access to all the albums, no matter it is user album or smart album in Limited Photo Access mode. And you can fetch assets from these collections without limitations. However, you cannot get any data from these assets if the user haven't selected it. I performed a requestImage operation on an asset which I haven't selected in the popup and it failed with domain error code: -1.

Evan
  • 430
  • 6
  • 16
  • One more thing, it is intended to make you have no access to any of the user album in *Limited Photo Access mode*. You can get more info [here at 11:11](https://developer.apple.com/videos/play/wwdc2020/10641/) . – Evan Nov 18 '20 at 08:25
-2

try to add a predicate with mediaType, then fetch the result

Xi Zhang
  • 95
  • 1