在 ios 13 PHImageManagerMaximumSize 上不起作用。
调用时
let manager = PHImageManager.default()
let option = PHImageRequestOptions()
option.isSynchronous = synchronous
option.isNetworkAccessAllowed = true
option.resizeMode = .exact
manager.requestImage(for: asset, targetSize: PHImageManagerMaximumSize, contentMode: .aspectFill, options: option, resultHandler: {(result, info) in
})
requestImage 返回错误: 错误域=NSCocoaErrorDomain Code=-1 "(null)"
此代码在 ios12 上运行良好
请问如何在ios13上获取原图?
最佳答案
引自 Apple 文档 here :
When you use the PHImageManagerMaximumSize option, Photos provides the largest image available for the asset without scaling or cropping. (That is, it ignores the resizeMode option.)
但是在这种情况下,resizeMode
似乎在 iOS 13 上生效。
将 resizeMode
设置为 .none
使 PHImageManagerMaximumSize
按预期工作。
关于swift - ios13 使用 PHImageManager 获取原始图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57658263/