我正在尝试获取与 PhotoLibrary 中的图像关联的深度数据。我可以获取图像和URL,但似乎无法获取与其关联的辅助数据。调用返回源,CGImageSourceCreateWithURL
但调用CGImageSourceCopyAuxiliaryDataInfoAtIndex
返回nil
和。我在这里缺少什么吗?kCGImageAuxiliaryDataTypeDisparity
kCGImageAuxiliaryDataTypeDepth
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
let image = info[UIImagePickerControllerOriginalImage]
let url = info[UIImagePickerControllerImageURL]
print("url=",url)
guard let source = CGImageSourceCreateWithURL(url as! CFURL, nil) else {
return
}
guard let auxDataInfo = CGImageSourceCopyAuxiliaryDataInfoAtIndex(source, 0, kCGImageAuxiliaryDataTypeDisparity) as? [AnyHashable : Any] else {
return
}
}