问题
Basically, when they hit "Don't Allow", the imagePicker isn't showing the screen that gives the user the instructions to go into privacy settings and turn it on.
If I kill the app and go back, the privacy setting is there. So I figured I probably need to manually do this when they touch "Don't Allow".
Is there a callback for when a user allows or doesn't allow access to their photo library? I can't find it in the docs. At the very least I could dismiss the imageView.
Thanks!
回答1:
If this is the first time the user tries to access the photo library from your app then the user is asked whether it is allowed or not. If the user chooses "Don't Allow" then at that point there is no reason to show a message telling them to go to settings. They just made their decision.
As a rule you should use ALAssetsLibrary authorizationStatus
so you can update your UI properly based on whatever choice the user made in the past.
But the 1st time it will be "not determined". There is no event that will tell you when the user actually makes their choice. And there is little need to know. If the user chooses "Don't Allow" they simply dismiss the image picker. If they choose "Allow" then they pick an image.
Answer: The only option you have is to see if authorizationStatus returns ALAuthorizationStatusNotDetermined. If it does, use ALAssetsLibrary enumerateGroupsWithTypes:usingBlock:failureBlock: and wait for the result. If you get the failure block check the authorizationStatus again. If it is now ALAuthorizationStatusDenied then you know the user tapped "Don't Allow".
来源:https://stackoverflow.com/questions/22942997/how-do-i-react-to-a-user-choosing-dont-allow-when-asking-for-permission-to-ac