Giz*_*odo 9 xcode avfoundation ios swift swift3
在GM Xcode(和iOS 11)之前运行良好.现在我收到这些错误:
Apple Mach-O Linker (ld) Error Group
"__T0So20AVCapturePhotoOutputC12AVFoundation01_abC16SwiftNativeTypesACWP", referenced from:
xxxxxxxxxx
"__T012AVFoundation37_AVCapturePhotoOutputSwiftNativeTypesPAAE012availableRawc11PixelFormatG0SaySo8NSNumberCGfg", referenced from:
xxxxxxxxx
" "__T0So22AVCapturePhotoSettingsC12AVFoundation01_abC16SwiftNativeTypesACWP", referenced from:
xxxxxxxxxx
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
它指向的一些行是:
photoSettings = AVCapturePhotoSettings(rawPixelFormatType: OSType(self.photoOutput.availableRawPhotoPixelFormatTypes.first!))
photoSettings.previewPhotoFormat = [kCVPixelBufferPixelFormatTypeKey as String: photoSettings.availablePreviewPhotoPixelFormatTypes.first!.uint32Value,
kCVPixelBufferWidthKey as String: 3024, kCVPixelBufferHeightKey as String: 3024]
Run Code Online (Sandbox Code Playgroud)
也:
let rawFormat = self.photoOutput.availableRawPhotoPixelFormatTypes.first!.uint32Value
photoSettings = AVCapturePhotoSettings(rawPixelFormatType: OSType(rawFormat),
processedFormat: [AVVideoCodecKey : AVVideoCodecJPEG,
AVVideoCompressionPropertiesKey : [AVVideoQualityKey : 1.0]] as [String : Any])
photoSettings.previewPhotoFormat = [kCVPixelBufferPixelFormatTypeKey as String: photoSettings.availablePreviewPhotoPixelFormatTypes.first!.uint32Value,
kCVPixelBufferWidthKey as String: 3024,
kCVPixelBufferHeightKey as String: 3024]
Run Code Online (Sandbox Code Playgroud)
gbh*_*all 17
Apple的官方回应:
我们的歉意.对于使用Swift 3.2或Swift 4.0的应用程序,几个AVFoundation捕获API(外部协议上的公共扩展)在Xcode 9中无意中被标记为私有.以下AVFoundation API暂时不可用:
AVCaptureDevice.Format.supportedColorSpaces
AVCaptureDevice.supportedFlashModes
AVCapturePhotoOutput.availablePhotoPixelFormatTypes
AVCapturePhotoOutput.availableRawPhotoPixelFormatTypes
AVCapturePhotoSettings.availablePreviewPhotoPixelFormatTypes作为一种解决方法,您可以通过在每个API前加双下划线(
__)来使用这些API的SwiftPrivate版本.例如,更改AVCaptureDevice.Format.supportedColorSpaces为AVCaptureDevice.Format.__supportedColorSpaces.
我可以确认使用__availablePreviewPhotoPixelFormatTypes修复构建错误.
例如
let settings = AVCapturePhotoSettings()
let previewPixelType = settings.__availablePreviewPhotoPixelFormatTypes.first!
Run Code Online (Sandbox Code Playgroud)
资料来源:https://forums.developer.apple.com/thread/86810#259270
| 归档时间: |
|
| 查看次数: |
1603 次 |
| 最近记录: |