-->

iOS photo permissions to ask for second time

2020-03-30 04:27发布

问题:

I am currently using alasset which asks for permission for first time. If want to pop permission second time or every time when user has blocked it, how it is possible.

回答1:

That dialog isn't controlled by the app, so no API for that.

You can reset things as a user in the settings app (IIRC) but no programmatic way.


To get the current authorization status:

[ALAssetsLibrary authorizationStatus];

(+ (ALAuthorizationStatus)authorizationStatus)

Also, methods to get assets taking access error blocks, e.g.:

- (void)assetForURL:(NSURL *)assetURL
        resultBlock:(ALAssetsLibraryAssetForURLResultBlock)resultBlock
       failureBlock:(ALAssetsLibraryAccessFailureBlock)failureBlock


回答2:

there is no way to show the permission prompt the second time.

The best way to handle the permission prompt is that you should explain to the user before triggering the permission prompt (read: call method in the AssetsLibrary framework). If the user still click on "Don't Allow", then you should tell the user how can he/she grant the permission via the Settings app as you cannot invoke the prompt for the second time.