#define OSVersionIsAtLeastiOS7 ([[UIDevice currentDevice].systemVersion floatValue]>= 7.0 ? YES:NO) //定义的宏
//检查相机是否可用
if (OSVersionIsAtLeastiOS7) {
NSString *mediaType = AVMediaTypeVideo;
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];
if (authStatus == AVAuthorizationStatusDenied) {
UIAlertView *alertView =[[UIAlertView alloc]initWithTitle:nil message:@"请前往系统设置->隐私->相机,开启爱维宝贝权限" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alertView show];
return;
}
}
---------------------------------
//检查相册是否可用
if (OSVersionIsAtLeastiOS7) {
ALAuthorizationStatus authStatus = [ALAssetsLibrary authorizationStatus];
if (authStatus == ALAuthorizationStatusDenied) {
UIAlertView *alertView =[[UIAlertView alloc]initWithTitle:nil message:@"请前往系统设置->隐私->相片,开启爱维宝贝权限" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alertView show];
return;
}
}