Swift无法启动AVCaptureSession

时间:2017-08-21 08:51:44

标签: swift avcapturesession

我想在我的应用中设置相机,这是我的所有代码

let captureSession = AVCaptureSession()

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

captureSession.startRunning()

在infoplist中,我设置了Privacy - Camera Usage Description,但是当我启动应用程序时,它不会要求任何权限。它会在控制台中打印这个长错误,而这一切都是

2017-08-21 12:47:43.686794+0400 Object Detection ML[26844:15000001] [] captureSourceSimulator_CopyProperty signalled err=-12784 (kCMBaseObjectError_PropertyNotFound) (Unknown property) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/EmbeddedCoreMedia_Sim/EmbeddedCoreMedia-2027.1.4/Celeste/Sources/Capture/CaptureSource/FigCaptureSourceSimulator.m:266
2017-08-21 12:47:43.687091+0400 Object Detection ML[26844:15000001] [] <<<< AVCaptureFigVideoDevice >>>> -[AVCaptureFigVideoDevice _copyFigCaptureSourceProperty:]_block_invoke: (0x7f9b27c06cf0) Copy(AttributesDictionary) failed (-12784)
2017-08-21 12:47:43.687710+0400 Object Detection ML[26844:15000001] [] captureSourceSimulator_CopyProperty signalled err=-12784 (kCMBaseObjectError_PropertyNotFound) (Unknown property) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/EmbeddedCoreMedia_Sim/EmbeddedCoreMedia-2027.1.4/Celeste/Sources/Capture/CaptureSource/FigCaptureSourceSimulator.m:266
2017-08-21 12:47:43.688007+0400 Object Detection ML[26844:15000001] [] <<<< AVCaptureFigVideoDevice >>>> -[AVCaptureFigVideoDevice _copyFigCaptureSourceProperty:]_block_invoke: (0x7f9b27c06cf0) Copy(Formats) failed (-12784)

Object Detection ML是项目的名称。这可能是什么问题?

0 个答案:

没有答案