gpt4 book ai didi

swift - ios13 使用 PHImageManager 获取原始图像

转载 作者:搜寻专家 更新时间:2023-11-01 06:50:31 25 4
gpt4 key购买 nike

在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com