虽然iOS10添加了隐私权限提示,但是当我们拒绝开启权限后,再次调用就会出现崩溃问题,为了避免这个问题,我们可以在调用设备前判断是否开启了调用权限
- (void)judgeCameraLimits{
/// 先判断摄像头硬件是否好用
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
// 用户是否允许摄像头使用
NSString * mediaType = AVMediaTypeVideo;
AVAuthorizationStatus authorizationStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];
// 不允许弹出提示框
if (authorizationStatus == AVAuthorizationStatusRestricted|| authorizationStatus == AVAuthorizationStatusDenied) {
[RMUtils alertWithTitle:@"" message:@