ios 相机权限访问

    xiaoxiao2021-12-14  23

    // 这是向系统请求访问相机的代码 [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) { NSLog(@"requestAccessForMediaType"); }]; // 一般这个是系统默认的,所以不需要我们手动添加,只是稍微了解一下。 //相机权限的获取 AVAuthorizationStatus cameraStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; switch (cameraStatus) { case AVAuthorizationStatusDenied: { [MessageTools showMessageWithSure:@"相机访问权限受限,请到系统\"设置\"页面打开相机访问权限!"]; return; } break; case AVAuthorizationStatusAuthorized: { //已经授权 } break; case AVAuthorizationStatusRestricted: { //client还未申请相机访问权限,用户不能更改相机访问权限状态 } break; case AVAuthorizationStatusNotDetermined: { //状态未知,用户还未处理是否允许应用访问相机 } break; default: break; }
    转载请注明原文地址: https://ju.6miu.com/read-963620.html

    最新回复(0)