判断相机权限
[code]+ (BOOL)isCameraAuthorization {NSString *mediaType = AVMediaTypeVideo;//读取媒体类型AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];//读取设备授权状态if(authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied || authStatus == AVAuthorizationStatusNotDetermined) {return NO;}return YES;}
请求授权
[code] [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {if (granted) {// 允许} else {// 拒绝}}];
麦克风同相机,修改传入枚举类型