Samir K
Samir K

Reputation: 91

Request for access to photo library prompt stays in the background

My request for photo library permissions prompt is supposed to pop up as soon as the app is launched. I have set up my info.plist with the library permission. I have tried both adding/removing the requestAuthorization(_:) function in my AppDelegate.swift in various lifecycle functions.

Current output: The app launches and stays on the launchscreen. When i click on the home button the app minimizes and the permissions prompt appears(as though it was lingering in the background). On allowing permission everything launches as expected.

Desired output: The app launches and the photo library permissions prompt appears on top(as it should). On click of which everything runs as usual.

I can attach pictures if this is not descriptive enough. Also there is no pertaining code as i have removed the requestAuthorization(_:) function(cuz not required). Any tip would go a long way as I have been fiddling with this for days now trying to get this fixed. Thank you!

Upvotes: 0

Views: 342

Answers (1)

Hobbes the Tige
Hobbes the Tige

Reputation: 3821

Your request call should be in the view controller (i.e. viewDidAppear), not the AppDelegate. Having the call in the app delegate is probably causing it to fire at an inappropriate time.

Upvotes: 0

Related Questions