IOS checks whether the app has the permission to use the camera.
IOS checks whether the app has the permission to use the camera.
NSString * mediaType = AVMediaTypeVideo;
AVAuthorizationStatus authStatus = [AVCaptureDeviceauthorizationStatusForMediaType: mediaType];
If (authStatus = ALAuthorizationStatusRestricted | authStatus = ALAuthorizationStatusDenied ){
NSLog (@ "Limited camera Permissions ");
Return;
}
-------
All statuses
Typedef NS_ENUM (NSInteger, ALAuthorizationStatus ){
ALAuthorizationStatusNotDetermined = 0, // User has not yet made a choice with regards to this application
ALAuthorizationStatusRestricted, // This application is not authorized to access photo data.
// The user cannot change this application's status, possibly due to active restrictions
// Such as parental controls being in place.
ALAuthorizationStatusDenied, // User has explicitly denied this application access to photos data.
ALAuthorizationStatusAuthorized // User has authorized this application to access photos data.
} _ OSX_AVAILABLE_STARTING (_ MAC_NA ,__ IPHONE_6_0 );
Note: add the AVFoundation library.