Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
556 views
in Technique[技术] by (71.8m points)

ios - Apple Mach-O Linker (ld) Error Group with Swift 3 & Xcode 9 GM

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]
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Update 15 Sept 2017:

Official response from Apple:

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

    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.

I can confirm using __availablePreviewPhotoPixelFormatTypes fixes the build errors.

E.g.

let settings = AVCapturePhotoSettings()
let previewPixelType = settings.__availablePreviewPhotoPixelFormatTypes.first!

Source: https://forums.developer.apple.com/thread/86810#259270


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...