? 實際運用場景:
上傳圖片,查看相機設備,使用相機 在做這些操作的時候先調用這段話
?
AVAuthorizationStatus authStatus =? [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
? ? if (authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied)
? ? {
? ? ? ? UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"未獲得授權使用相機,請在iOS\"設置中\"-\"隱私\"-\"相機\"中打開" delegate:nil cancelButtonTitle:@"確定" otherButtonTitles:nil];
? ? ? ? [alertView show];
? ? ? ? return;
? ? }