Apple Mach-O Linker (ld) Error Group with Swift 3 &Xcode 9 通用 [英] Apple Mach-O Linker (ld) Error Group with Swift 3 & Xcode 9 GM
问题描述
这一直运行良好,直到 GM Xcode(和 iOS 11).现在我收到这些错误:
This was running fine till GM Xcode (and iOS 11). Now I get these errors:
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)
它指向的一些行是:
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]
还有:
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]
推荐答案
2017 年 9 月 15 日更新:
苹果官方回应:
我们深表歉意.对于使用 Swift 3.2 或 Swift 4.0 的应用程序,几个AVFoundation 捕获 API(外部协议的公共扩展)在 Xcode 9 中被无意中标记为私有.以下AVFoundation API 暂时不可用:
Our apologies. For apps using Swift 3.2 or Swift 4.0, several AVFoundation capture APIs (public extensions on external protocol) were inadvertently marked private in Xcode 9. The following AVFoundation API are temporarily unavailable:
AVCaptureDevice.Format.supportedColorSpaces
AVCaptureDevice.supportedFlashModes
AVCapturePhotoOutput.availablePhotoPixelFormatTypes
AVCapturePhotoOutput.availableRawPhotoPixelFormatTypes
AVCapturePhotoSettings.availablePreviewPhotoPixelFormatTypes
作为一种解决方法,您可以使用这些 API 的 SwiftPrivate 版本通过在每个 API 前面加上双下划线 (__
).例如,将 AVCaptureDevice.Format.supportedColorSpaces
更改为AVCaptureDevice.Format.__supportedColorSpaces
.
As a workaround you can use the SwiftPrivate versions of these API
by prepending each API with double underscore (__
). For example,
change AVCaptureDevice.Format.supportedColorSpaces
to
AVCaptureDevice.Format.__supportedColorSpaces
.
我可以确认使用 __availablePreviewPhotoPixelFormatTypes
修复构建错误.
I can confirm using __availablePreviewPhotoPixelFormatTypes
fixes the build errors.
例如
let settings = AVCapturePhotoSettings()
let previewPixelType = settings.__availablePreviewPhotoPixelFormatTypes.first!
来源:https://forums.developer.apple.com/thread/86810#259270
这篇关于Apple Mach-O Linker (ld) Error Group with Swift 3 &Xcode 9 通用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!