ios - 如果快速拒绝访问照片库的权限,如何直接进入设置
问题描述
class func checkPhotoLibraryPermission() {
// TODO: @Umer Complete this process as discussed
let photoAuthorizationStatus = PHPhotoLibrary.authorizationStatus()
switch photoAuthorizationStatus {
case .authorized:
print("Access is granted by user")
case .notDetermined:
PHPhotoLibrary.requestAuthorization({
(newStatus) in
print("status is \(newStatus)")
if newStatus == PHAuthorizationStatus.authorized {
/* do stuff here */
print("success")
}
else {
}
})
print("It is not determined until now")
case .restricted:
print("User do not have access to photo album.")
case .denied:
print("User has denied the permission.")
}
}
in case .denied 如果我们第一次访问照片库的访问权限被询问给用户,如果用户不允许权限,下次当用户尝试访问照片库时,它直接进入用户可以手动设置权限的设置。
解决方案
推荐阅读
- r - 使用泊松回归进行预测
- image - Keras:使用“输入”层时出现“Found: Tensor("input_1:0", shape=(None, 256, 256, 2), dtype=float32)" 错误
- c# - 通过 HTML BeginForm 传递列表和模型实例
- html - 协助创建 HTTP POST
- ios - 拖放在 macOS 上不起作用,但在 iOS 上起作用(使用 Catalyst)
- javascript - 无法通过模拟器运行 React-Native 应用程序
- javascript - React - 提交表单时显示新组件
- intellij-idea - 插件 Intellij - 在 IDE 终端中显示命令
- typescript - 如何根据我在纱线工作区中设置断点的位置来调试打字稿?
- javascript - useEffect TypeError:不可迭代