JLPhotoLibrary
Provides methods to requesting Photo Library and Camera permissions
- Since:
3.0.1
Overview
It would be required if your app wants to access camera or photo library.
Topics
Actions
$photolibrary.granted()
- Since
3.0.1
Returns Promise.resolve(Bool)
if the permission is granted.
Example
$photolibrary.granted().then(granted => alert(granted));
$photolibrary.authorize(showAlert = true)
- Since
3.0.1
Returns Promise.resolve(Int)
with the Authorization Status.
If showAlert = true
then it will prompt an alert requesting the user go Settings.
The returned number corresponds to PHAuthorizationStatus
By default will request access to all photos.
Example
$photolibrary.authorize().then(status => $logger.trace(status));
$photolibrary.camera.granted()
- Since
3.0.2
Returns Promise.resolve(Bool)
if the camera permission is granted.
Example
$photolibrary.granted().then(granted => alert(granted));
$photolibrary.camera.authorize(showAlert = true)
- Since
3.0.2
Returns Promise.resolve(Int)
with the Camera authorization status.
If showAlert = true
then it will prompt an alert requesting the user go Settings.
The returned number corresponds to AVAuthorizationStatus
Example
$photolibrary.camera.authorize().then(status => $logger.trace(status));
info.plist
Add the following permissions to info.plist
:
-
PHPhotoLibraryPreventAutomaticLimitedAccessAlert Set to
YES
. -
NSPhotoLibraryAddUsageDescription Description.
<key>NSPhotoLibraryUsageDescription</key>
<string>If you want to use the photolibrary, you have to give permission.</string>
<key>NSCameraUsageDescription</key>
<string>If you want to use the camera, you have to give permission.</string>