1.导入头文件
import AVFoundation
2.判断
let status = AVCaptureDevice.authorizationStatus(for: .video)
print("status.rawValue == \(status.rawValue)")
// status 为枚举 AVAuthorizationStatus 它有四个值
// case notDetermined = 0 用户还没有关于这个应用程序做出了选择
// case restricted = 1 这个应用程序未被授权访问图片数据
// case denied = 2 用户已经明确否认了这个应用程序访问图片数据
// case authorized = 3 用户授权此应用程序访问图片数据
if status == .denied || status == .restricted{
//弹框引导用户进入到系统设置界面
//跳转到设置界面
// UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!, options: [:], completionHandler: nil)
print("权限关闭了")
}else{
print("打开了权限")
}