iOS photo permissions to ask for second time

2020-03-30 04:37发布

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.

2条回答
干净又极端
2楼-- · 2020-03-30 04:49

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.

查看更多
兄弟一词,经得起流年.
3楼-- · 2020-03-30 04:54

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
查看更多
登录 后发表回答