我得到了以下代码片段:
let newPhotoSettings = AVCapturePhotoSettings(rawPixelFormatType: OSType(self.photoOutput.availableRawPhotoPixelFormatTypes.first!), processedFormat: nil)当我在Xcode12beta6中构建时,我得到了以下错误:
Value of type 'AVCapturePhotoOutput' has no member 'availableRawPhotoPixelFormatTypes'当我检查API文档(here)时,它没有将availableRawPhotoPixelFormatTypes显示为已弃用。
其他人也有这个问题吗?
更新
以上错误仅在我尝试为主屏幕小工具呈现SwiftUI预览时出现。如果我正常运行这个项目,它运行得非常好,没有错误。
另外,我也得到了预览像素类型的相同错误:
photoSettings.previewPhotoFormat = [kCVPixelBufferPixelFormatTypeKey as String: photoSettings.availablePreviewPhotoPixelFormatTypes[0]]
Value of type 'AVCapturePhotoSettings' has no member 'availablePreviewPhotoPixelFormatTypes'发布于 2020-09-13 21:39:13
现在,这似乎被分成了两个查询:
使用availableRawPhotoFileTypes获取支持的原始文件类型,选择其中一种,然后使用supportedRawPhotoPixelFormatTypes(for fileType: AVFileType)询问相应的支持的格式类型。
我认为目前在iOS中只支持DNG文件,但分离API可能更适合未来。
https://stackoverflow.com/questions/63865476
复制相似问题