I am trying to unit test retrieving assetCollection and assets. In order to be allowed to access my PhotoAlbums I have to grant permissions. This normally either happens during the first call of a function like fetchAssetCollections
or manually by calling PHPhotoLibrary.requestAuthorization()
.
Now the question is how can I assume I have permissions when running my unit tests? Because as soon as I call PHAssetCollection.fetchAssetCollections(withLocalIdentifiers: [ album ], options: nil)
I get a PHUnauthorizedFetchResult
.