ios 獲取相機權限

 UIImagePickerController *imagepk=[[UIImagePickerController alloc]init];
    AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
    if(status == AVAuthorizationStatusAuthorized) {
    } else if(status == AVAuthorizationStatusDenied){
     } else if(status == AVAuthorizationStatusRestricted){
    } else if(status == AVAuthorizationStatusNotDetermined){
        [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
            if(granted){
            } else {
                return;
            }
        }];
    }

相關文章
相關標籤/搜索