ios - 尝试 Apple 的 Sample AVCAM 发现错误

标签 ios swift xcode ios11

当我尝试使用 Xcode Version 9.0 beta 5 (9M202q) 示例 AVCAM swift 时。我发现了错误。

Undefined symbols for architecture x86_64:
"__T0So22AVCapturePhotoSettingsC12AVFoundation01_abC16SwiftNativeTypesACWP", referenced from: __T05AVCam20CameraViewControllerC12capturePhoto33_F53A4CF98D799BDDCA6C04BA14C549A1LLySo8UIButtonCFyycfU_ in CameraViewController.o
"__T012AVFoundation39_AVCapturePhotoSettingsSwiftNativeTypesPAAE016availablePreviewc11PixelFormatG0Says6UInt32VGfg", referenced from: __T05AVCam20CameraViewControllerC12capturePhoto33_F53A4CF98D799BDDCA6C04BA14C549A1LLySo8UIButtonCFyycfU_ in CameraViewController.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

问题是什么?以及如何解决这个问题?

最佳答案

2017 年 9 月 15 日更新:

苹果官方回应:

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.

我可以确认使用 __availablePreviewPhotoPixelFormatTypes 修复了构建错误。

例如

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

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


2017 年 9 月 14 日更新:

问题在 Xcode 9.0 GM (9A235) 中再次出现。

已提交新错误报告以供引用:rdar://34420979


上一个:

更新:已在 Xcode Beta 6 中修复。

针对 Xcode 版本 9.0 beta 5 (9M202q) 提交了错误报告 rdar://33935456

关于ios - 尝试 Apple 的 Sample AVCAM 发现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45668293/

相关文章:

ios - 将工具栏定位在屏幕顶部,底部有正确的阴影

ios - 从 Mac 中的 ios 客户端调用 PC 中的 signalR 服务器

ios - 在自动布局约束中设置的值与 subview 上元素的位置不匹配

ios - ios13音频流在后台被切断

ios - 错误 : Argument passed to call that takes no arguments

swift - 从 Firebase 更新值后如何停止 reloadData 滚动到我的应用程序的顶部?

swift - viewDidLoad 上的 NSView alpha 不显示

ios - Storyboard 状态栏后面的内容

ios - xCode在Unity3D项目中找不到头文件

ios - 合奏和 journal_mode ="DELETE"