Aakash Dave Aakash Dave - 5 months ago 98
iOS Question

Swift Apple Mach-O linker error

I converted my project from swift 3 to swift 4 and am using the latest version of xcode 9. On building, I get the following error :

Undefined symbols for architecture arm64:
"__T0So22AVCapturePhotoSettingsC12AVFoundation01_abC16SwiftNativeTypesACWP", referenced from:
__T06SpotMi8CameraVCC12capturePhotoyypF in CameraVC.o
"__T012AVFoundation39_AVCapturePhotoSettingsSwiftNativeTypesPAAE016availablePreviewc11PixelFormatG0SaySo8NSNumberCGfg", referenced from:
__T06SpotMi8CameraVCC12capturePhotoyypF in CameraVC.o
ld: symbol(s) not found for architecture arm64

I am out of clues. Any help will be much appreciated.


Answer Source

There is a bug in XCode9. Apple inadvertendly made some functions in AVFoundation private.


Change "availablePreviewPhotoPixelFormatTypes" to "__availablePreviewPhotoPixelFormatTypes" in your source.

Same goes for the following:

"supportedColorSpaces" -> "__supportedColorSpaces"

"supportedFlashModes" -> "__supportedFlashModes"

"availableRawPhotoPixelFormatTypes" -> "__availableRawPhotoPixelFormatTypes"

"availablePhotoPixelFormatTypes" -> "__availablePhotoPixelFormatTypes"

Then it might compile! Good Luck!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download