[英]How to display photo library permissions dialog in Cordova?
Hi we are developing an IBM MobileFirst Platform-based Hybrid Application.您好,我们正在开发基于 IBM MobileFirst 平台的混合应用程序。 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.
为此,在 iPhone 中我们需要明确询问用户权限,在 iPhone 中要询问用户权限,我们需要显示对话框。 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?
在这里,我的问题是我们将向用户显示的对话框是自定义对话框还是 MobileFirst 中内置了任何本机功能,或者在任何cordova插件的帮助下?
You can use requestCameraRollAuthorization()
in cordova-diagnostic-plugin to request native iOS permission to access the user photos:您可以在cordova-diagnostic-plugin 中使用
requestCameraRollAuthorization()
来请求访问用户照片的原生 iOS 权限:
cordova.plugins.diagnostic.requestCameraRollAuthorization(function(granted){
console.log("Authorization request for camera roll was " + (granted ? "granted" : "denied"));
}, function(error){
console.error(error);
});
MobileFirst does not handle any permissions for you - it is not that kind of a framework. MobileFirst 不会为您处理任何权限 - 它不是那种框架。 This really relates to the Cordova layer in your app, which access the photo library.
这确实与您的应用程序中的 Cordova 层有关,它访问照片库。
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.
例如,您可以为此目的使用 WL.SimpleDialog。
Read more here:在此处阅读更多信息:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.