-
Notifications
You must be signed in to change notification settings - Fork 1
Camera Permission
Camera usage always requires explicit permission from the user. Your app must provide an explanation for its use of capture devices using the NSCameraUsageDescription Info.plist key. iOS displays this explanation when initially asking the user for permission, and thereafter in the Settings app. Calling this method or attempting to start a capture session without a usage description raises an exception.
The following code snippet requests the user’s camera permission.
using SA.iOS.AVFoundation;
...
ISN_AVCaptureDevice.RequestAccess(ISN_AVMediaType.Video, (status) => {
if(status == ISN_AVAuthorizationStatus.Authorized) {
Debug.Log("user has granted camera permission");
} else {
Debug.Log("uAVMediaType.Video Permission declined");
}
});
You can always check current authorization status as shown on a snippet below:
using SA.iOS.AVFoundation;
...
ISN_AVAuthorizationStatus status;
status = ISN_AVCaptureDevice.GetAuthorizationStatus(ISN_AVMediaType.Video);
Debug.Log("Camera Authorization Status: " + status);
The NSCameraUsageDescription canbe provided with the IOS Native Settings editor. See the picture below:
![CameraPermission](https://user-images.githubusercontent.com/63166821/78588494-6cb47b80-7847-11ea-93b3-6d2c4ad60e4e.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