ios - 错误 : Type 'String!' has no member 'video'

标签 ios swift

import UIKit
import AVKit

class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()

//start camera

        let captureSession = AVCaptureSession()

        guard let captureDevice =
           AVCaptureDevice.default(for: .video) else { return }
        guard let input = try? AVCaptureDeviceInput(device:
                captureDevice ) else { return }
        captureSession.addInput(input)

        captureSession.startRunning()
    }
}

我在 (for: .video) 的这一行中收到错误:

AVCaptureDevice.default(for: .video) else { return }

最佳答案

用 AVMediaTypeVideo 替换 AVMediaType.video 对我有用。

关于ios - 错误 : Type 'String!' has no member 'video' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45147649/

相关文章:

ios - UIView.animate 似乎卡住了其他 View 更新

ios - Cloudkit: "ZoneId provided doesn' t 匹配目标区域”

iOS - 将 jpeg 文件写入文件系统

iphone - 为什么标签文本不总是从同一点开始?

ios - 如何让十进制键盘在 iOS 中消失

ios - 使用facetime实现视频通话功能,(通话结束无法返回应用)

ios - 基于 swift 的单 View iOS 应用程序中的 NXOAuth2Client : how to import the library

swift - 为什么写acos(1.0)可以,写acos(1)不行?

ios - Swift xcode 错误 "cannot subscript a value of type ' [ListOfAnimals]'

ios - 上传视频文件到服务器