float deviceIOSVersion = [[UIDevice currentDevice].systemVersion floatValue];
if (deviceIOSVersion >= 7.0) {
if (type == UIImagePickerControllerSourceTypeCamera) {
//相机权限
AVAuthorizationStatus cameraStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if (cameraStatus == AVAuthorizationStatusDenied || cameraStatus == AVAuthorizationStatusRestricted) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"相机权限未开,请到设置中开启" delegate:nil cancelButtonTitle:@"Close" otherButtonTitles:nil];
[alert show];
return;
}
}else{
//相册权限
ALAuthorizationStatus libraryStatus = [ALAssetsLibrary authorizationStatus];
if (libraryStatus == ALAuthorizationStatusDenied || libraryStatus == ALAuthorizationStatusRestricted) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"相册权限未开,请到设置中开启" delegate:nil cancelButtonTitle:@"Close" otherButtonTitles:nil];
[alert show];
return;
}
}
}