```
//定位權(quán)限
if([CLLocationManager locationServicesEnabled] && [CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied) {
[self initerrorAlertView];
return;
}else{
NSLog(@"打開");
}
//相冊權(quán)限
ALAuthorizationStatus author = [ALAssetsLibraryauthorizationStatus];
if (author == ALAuthorizationStatusRestricted || author ==ALAuthorizationStatusDenied){
//無權(quán)限
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"提示" message:@"請?jiān)赲"隱私\"里開啟照片權(quán)限" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"確定", nil];
return;
}
//相機(jī)權(quán)限
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if (authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied)
{
//無權(quán)限
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"提示" message:@"請?jiān)赲"隱私\"里開啟相機(jī)權(quán)限" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"確定", nil];
return;
}
//麥克風(fēng)權(quán)限
AVAudioSession *avSession = [AVAudioSession sharedInstance];
if ([avSession respondsToSelector:@selector(requestRecordPermission:)]) {
[avSession requestRecordPermission:^(BOOL available) {
if (available) {
//completionHandler
}
else
{
dispatch_async(dispatch_get_main_queue(), ^{
[[[UIAlertView alloc] initWithTitle:@"無法錄音" message:@"請?jiān)凇霸O(shè)置-隱私-麥克風(fēng)”選項(xiàng)中開啟權(quán)限" delegate:nil cancelButtonTitle:@"確定" otherButtonTitles:nil] show];
return ;
});
}
}];
}
//用戶通知開關(guān)
if ([[UIApplication sharedApplication] enabledRemoteNotificationTypes] == UIRemoteNotificationTypeNone) {
已關(guān)閉;
}else
已開啟;
```