Try Sample AVCAM from apple found error

前端 未结 4 810
野趣味
野趣味 2020-12-08 23:50

When I tried sample AVCAM swift with Xcode Version 9.0 beta 5 (9M202q). I found errors.

Undefined symbols for architecture x86_64:
\"__T0So22AVC

相关标签:
4条回答
  • 2020-12-09 00:04

    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


    Update 14 Sept 2017:

    Issue reoccurs in Xcode 9.0 GM (9A235).

    Filed new bug report for reference: rdar://34420979


    Previous:

    Update: Fixed in Xcode Beta 6.

    Filed a bug report rdar://33935456 for Xcode Version 9.0 beta 5 (9M202q).

    0 讨论(0)
  • 2020-12-09 00:12

    This appears to be an Xcode bug. The sample code builds fine in Xcode 9.0 beta (9M136h). Reported to Apple as rdar://33903950.

    Update: Radar is now closed. Issue is fixed in Xcode 9.0 Beta 6 (9M214v).

    0 讨论(0)
  • 2020-12-09 00:15

    Xcode 9.0 beta 5 (9M202q) definitely has a problem with AVCam Swift revision 2017-06-06. Fortunately the problem is isolated to these three lines in CameraViewController.swift:

    if !photoSettings.availablePreviewPhotoPixelFormatTypes.isEmpty {
        photoSettings.previewPhotoFormat = [kCVPixelBufferPixelFormatTypeKey as String: photoSettings.availablePreviewPhotoPixelFormatTypes.first!]
    }
    

    Comment out the above code and AVCam will compile and run fine on a device running the latest iOS 11 beta.

    0 讨论(0)
  • 2020-12-09 00:22

    Try to add AVFoundation to linked frameworks (Target -> Build Phases -> Link Binary with Libraries)

    0 讨论(0)
提交回复
热议问题