1.相机权限
NSString *mediaType = AVMediaTypeVideo;//读取媒体类型
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];//读取设备授权状态
if(authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied){
NSLog(@"没有开启相机权限");
}
2.麦克风权限(注意这是异步的)
[[AVAudioSession sharedInstance]requestRecordPermission:^(BOOL granted) {
if (!granted)
{
NSLog(@"没有开启麦克风权限");
}else{
NSLog(@"已经开启麦克风权限");
}
3.跳转设置
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];