ios - 无法使用照片库上传图片
问题描述
在发现扩展时遇到的 ios 应用程序错误中从图库中选择图像后,我收到此错误:错误域 = 插件代码 = 13“查询已取消”用户信息 = {NSLocalizedDescription = 查询取消}
我还添加了-隐私-照片库照片描述、相机描述。
也尝试过 - OS_ACTIVITY_MODE 禁用
但仍然无法修复
解决方案
我不确定您使用的是什么代码,但问题之一可能是您没有正确处理所有授权案例。
func performPermissionCheck() {
let authorisationStatus = PHPhotoLibrary.authorizationStatus()
switch authorisationStatus {
case .authorized:
print("Access granted")
case .notDetermined:
PHPhotoLibrary.requestAuthorization({ newStatus in
if newStatus == PHAuthorizationStatus.authorized {
print("success")}
})
case .restricted:
print("No access to album")
case .denied:
print("Permission Denied")
}
}
推荐阅读
- typescript - 如何在nestjs中通过socket.io在客户端之间发送图像?
- c# - 多对多 EF Core 已被跟踪 - C# Discord Bot
- excel - 使未列出的数据看起来像在将其放入表格之前
- python - 使用循环和列表检查值 - Python
- javascript - 使用 JavaScript 自动填充 Django 模型字段始终失败
- sql - 每列值 XX 行的随机样本
- android - Android CollapsingToolbarLayout 有两个吸附点
- logging - 省略将特定日志导出到已配置的远程系统日志服务器
- mysql - Mysql ibd 文件有 10Mb 的记录但它不恢复它们?
- discord - 从另一个文件调用命令