Commit a03b8e08 authored by Steven杜宇's avatar Steven杜宇

// 权限设置

parent 550ea6ed
...@@ -85,8 +85,10 @@ class YHMyPermissionSettingVC: YHBaseViewController { ...@@ -85,8 +85,10 @@ class YHMyPermissionSettingVC: YHBaseViewController {
func requestPermission() { func requestPermission() {
// 1)获取网络状态并更新
updateNetWorkStatus() updateNetWorkStatus()
// 获取相册权限
// 2)获取相册权限
requestPhotoLibraryPermission { requestPhotoLibraryPermission {
[weak self] grant in [weak self] grant in
guard let self = self else { return } guard let self = self else { return }
...@@ -100,7 +102,7 @@ class YHMyPermissionSettingVC: YHBaseViewController { ...@@ -100,7 +102,7 @@ class YHMyPermissionSettingVC: YHBaseViewController {
} }
} }
// 获取相机权限 // 3)获取相机权限
requestCameraPermission { requestCameraPermission {
[weak self] grant in [weak self] grant in
guard let self = self else { return } guard let self = self else { return }
...@@ -129,6 +131,13 @@ class YHMyPermissionSettingVC: YHBaseViewController { ...@@ -129,6 +131,13 @@ class YHMyPermissionSettingVC: YHBaseViewController {
case .notDetermined: case .notDetermined:
// 尚未确定,请求授权 // 尚未确定,请求授权
PHPhotoLibrary.requestAuthorization {
authorizationStatus in
self.requestPhotoLibraryPermission {
granted in
completion(granted)
}
}
completion(false) completion(false)
@unknown default: @unknown default:
...@@ -150,6 +159,10 @@ class YHMyPermissionSettingVC: YHBaseViewController { ...@@ -150,6 +159,10 @@ class YHMyPermissionSettingVC: YHBaseViewController {
case .notDetermined: case .notDetermined:
// 尚未确定,请求授权 // 尚未确定,请求授权
AVCaptureDevice.requestAccess(for: .video) {
granted in
completion(granted)
}
completion(false) completion(false)
@unknown default: @unknown default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment