所以我有以下代码,我想创建一个保存在类TRoom中的不同食物的列表。
import UIKit
import AVFoundation
@available(iOS 10.0, *)
class ScanViewController: UIViewController {
var captureSession = AVCaptureSession?.self
var videoPreviewLayer: AVCaptureVideoPreviewLayer?
@IBOutlet weak var previewView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
// Get the back-facing camera for capturing videos
//***ERROR OCCURRS ON THIS LINE***
let deviceDiscoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInDualCamera], mediaType: AVMediaType.video, position: .back)
guard let captureDevice = deviceDiscoverySession.devices.first else {
print("Failed to get the camera device")
return
}
实施例:
睡觉:TRoom
在“睡觉”中,苹果和香蕉都是物体。
感谢您的帮助 Nuraxx