let accessLevel : PHAccessLevel = .readWrite
let phStatus = PHPhotoLibrary.authorizationStatus(for: accessLevel)
if (phStatus == .notDetermined) {
PHPhotoLibrary.requestAuthorization(for: accessLevel) {
newStatus in
if (newStatus == .limited) {
var conf = PHPickerConfiguration()
conf.selectionLimit = 1
conf.filter = .any(of: [.images, .livePhotos])
let picker = PHPickerViewController(configuration: conf)
picker.delegate = self
self.present(picker, animated: true)
}
}
}
Run Code Online (Sandbox Code Playgroud)
我使用上面的代码来测试 iOS 14 新功能 Limited Photos Library。在代码中,我使用了 new Api authorizationStatus和requestAuthorization,并成功获得了 .limited 状态。但尽管处于 .limited 状态,iOS 14 仍然显示库的所有照片。谁能帮我解决这个问题?