在新的 Xcode 12 中,我在权限范围内遇到了一个特殊的错误。 开关必须详尽无遗地添加 .limited 案例。虽然我添加了 .limited case 它仍然显示这个错误。我在使用 switch case 的地方得到了这个。你能为我指出正确的方向吗。我最近将我的项目从 Xcode 11 升级到 Xcode 12,所以在这里有点困惑。
func openPhotoController(item: InfoItem) {
let status = PHPhotoLibrary.authorizationStatus()
switch status {
case .authorized:
DispatchQueue.main.async
{
let photoLib = photoLibViewController()
photoLib.delegate = self
photoLibCropImage = false
photoLib.modalTransitionStyle = .crossDissolve
photoLib.modalPresentationStyle = .fullScreen
photoLib.allowMultipleSelection = false
self.present(photoLib, animated: true, completion: nil)
}
print("authorized")
//handle authorized status
case .denied, .restricted :
print("denied")
AlertManager.showAlertView(title: "Alert?", subtitle: "Please allow access to your photo library to use …Run Code Online (Sandbox Code Playgroud)