-
Notifications
You must be signed in to change notification settings - Fork 1
Photos Permissions
Make sure that Photo Kit is enabled, before using this API.
Accessing the Photos library always requires explicit permission from the user. Your app’s info.plist file must provide a value for the NSPhotoLibraryUsageDescription key that explains to the user why your app is requesting Photos access. Apps linked on or after iOS 10.0 will crash if this key is not present. After the user grants permission, the system remembers the choice for future use in your app, but the user can change this choice at any time using the Settings app. If the user has denied your app photo library access, not yet responded to the permission prompt, or cannot grant access due to restrictions.
The following code snippet requests the user’s photo library permission.
using SA.iOS.Photos;
...
ISN_PHPhotoLibrary.RequestAuthorization((status) => {
if(status == ISN_PHAuthorizationStatus.Authorized) {
Debug.Log("Permission granted");
} else {
Debug.Log("Permission denied");
}
});
You can always check current authorization status as shown on a snippet below:
using SA.iOS.Photos;
...
ISN_PHAuthorizationStatus status;
status = ISN_PHPhotoLibrary.AuthorizationStatus;
Debug.Log("Photo Library Authorization Status: " + status);
The NSPhotoLibraryUsageDescription canbe provided with the IOS Native Settings editor. See the picture below:
![PhotosPermissions](https://user-images.githubusercontent.com/63166821/78602581-5e725980-785f-11ea-8b38-7e5f92752009.png)
Reliable and high-quality Unity Development service. Let's Talk!
Website | AssetStore | LinkedIn | Youtube | Scripting Reference
- Getting Started
- Authentication
- Game Center UI
- Leaderboards
- Default Leaderboard
- Achievements
- Saving A Game
- Access Point
- iTunes Connect Setup
- StoreKit Initialization
- Purchase flow
- Receipt Validation
- Store Review Controller
- Storefront API
- Subscription Offers