How to display photo library permissions dialog in

2019-02-20 00:30发布

Hi we are developing an IBM MobileFirst Platform-based Hybrid Application. In our application we are accessing user gallery (to upload photos). for this in iPhone we need to ask the user permission explicitly, to ask user permission in iPhone we need to display dialog box. Here my question is the dialog box which we are going to show to the user is custom dialog box or is there any native feature built-in in MobileFirst, or with the help of any cordova plugin?

2条回答
男人必须洒脱
2楼-- · 2019-02-20 01:06

You can use requestCameraRollAuthorization() in cordova-diagnostic-plugin to request native iOS permission to access the user photos:

cordova.plugins.diagnostic.requestCameraRollAuthorization(function(granted){
    console.log("Authorization request for camera roll was " + (granted ? "granted" : "denied"));
}, function(error){
    console.error(error);
});
查看更多
虎瘦雄心在
3楼-- · 2019-02-20 01:26

MobileFirst does not handle any permissions for you - it is not that kind of a framework. This really relates to the Cordova layer in your app, which access the photo library.

You need to display a dialog box asking the user whether or not does s/he allow for the access to access the photo library. You can use WL.SimpleDialog for this purpose, for example.

Read more here:

查看更多
登录 后发表回答