#import <AVFoundation/AVFoundation.h>
#import <Photos/Photos.h>
#import <CoreLocation/CoreLocation.h>
#import <AddressBook/AddressBook.h>
#import <AddressBookUI/AddressBookUI.h>
#import <EventKit/EventKit.h>
/**相机权限*/
+ (void)checkCameraAuthorizationGrand:(void (^)(void))permissionGranted
withNoPermission:(void (^)(void))noPermission
{
AVAuthorizationStatus videoAuthStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
switch (videoAuthStatus) {
case AVAuthorizationStatusNotDetermined:
{
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
granted ? permissionGranted() : noPermission();
}];
break;
}
case AVAuthorizationStatusAuthorized:
{
permissionGranted();
break;
}
case AVAuthorizationStatusRestricted:
NSLog(@"不能完成授权,可能开启了访问限制");
noPermission();
case AVAuthorizationStatusDenied:{
NSLog(@"请到设置授权访问相机");
noPermission();
}
break;
default:
break;
}
}
/**相册权限*/
+ (void)checkPhotoAlbumAuthorizationGrand:(void (^)(void))permissionGranted