首页 > 解决方案 > 无法使用照片库上传图片

问题描述

在发现扩展时遇到的 ios 应用程序错误中从图库中选择图像后,我收到此错误:错误域 = 插件代码 = 13“查询已取消”用户信息 = {NSLocalizedDescription = 查询取消}

我还添加了-隐私-照片库照片描述、相机描述。

也尝试过 - OS_ACTIVITY_MODE 禁用

但仍然无法修复

标签: iosobjective-cimagegallery

解决方案


我不确定您使用的是什么代码,但问题之一可能是您没有正确处理所有授权案例。

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")
   }
}

推荐阅读