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)
Some of the lines it's pointing at are:
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]
Also:
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]
I've changed:
to:
and
to
and the app started.
Update 15 Sept 2017:
Official response from Apple:
I can confirm using
__availablePreviewPhotoPixelFormatTypes
fixes the build errors.E.g.
Source: https://forums.developer.apple.com/thread/86810#259270
This bug was present in earlier beta versions of Xcode 9 (
rdar://33903950
) and was apparently resolved (see this SO question). It's returned for me as well in the GM build. I'm filingrdar ://34412264
about this issue. Hopefully it's resolved soon and another GM build is related; until then, I you can continue working using earlier beta versions of Xcode 9, but won't be able to release that work. This is a total show-stopper for my app.Edit: I'll also mention that commenting lines pertaining to
AVCapturePhotoSettings
' preview properties (previewPhotoFormat
,kCVPixelBufferPixelFormatTypeKey
,kCVPixelBufferWidthKey
, etc.) allows your project to build. If it's possible for you to omit these in your project, this may be a good workaround for now.