1

Is there a way to find what triggers Photo Library authorization request?

I can't find what line exactly triggers the permission request for Photo Library.

I've searched workspace for [PHPhotoLibrary requestAuthorization] - no luck.

What should I search for to find line that triggers Photo Library authorization request?

Device is on iOS 9.

kerd
  • 307
  • 2
  • 13

2 Answers2

3

So, it was [[PHCachingImageManager alloc] init]. This line calls for permission.

kerd
  • 307
  • 2
  • 13
-1

If you read the documentation for requestAuthorization:, you'll see:

The first time your app uses PHAsset, PHCollection, PHAssetCollection, or PHCollectionList methods to fetch content from the library, or uses one of the methods listed in Applying Changes to the Photo Library to request changes to library content, Photos automatically and asynchronously prompts the user to request authorization. Alternatively, you can call this method to prompt the user at a time of your choosing.

Jim
  • 72,985
  • 14
  • 101
  • 108
  • Well, thanks, I did read it before posting the question. My guess was that it was something outside Photos framework, because, as I said, I do not import it by that time. Is that possible? – kerd Jul 05 '16 at 22:48
  • Are you sure it's a photos authorisation request and not the recording permission request? – Jim Jul 05 '16 at 22:53
  • The documentation is misleading. Just initializing a `PHCachingImageManager` already triggers the authorization request, but the paragraph you quote sounds like it wouldn't, as we don't call any of the mentioned methods. I had the same problem as OP. – Theo Dec 18 '18 at 14:09