Last active
January 8, 2020 11:59
-
-
Save qy1010/0cf6d307488cfce2eb09c9160b97a581 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (void)checkCameraPermission:(void(^)(BOOL status))block | |
{ | |
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];//读取设备授权状态 | |
if (authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied) { | |
if (block) { | |
block(NO); | |
} | |
return; | |
} | |
else if (authStatus == AVAuthorizationStatusNotDetermined) { | |
if (block) { | |
block(NO); | |
} | |
} | |
else if (authStatus == AVAuthorizationStatusAuthorized) { | |
if (block) { | |
block(YES); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment