AVCaptureSession startRunning exc_bad_access iOS 10 Swift 3

Har*_*hem 3 ios swift

我在启动AVCaptureSession时遇到了exc_bad_access崩溃:

        if captureSession.isRunning == false {
           captureSession.startRunning()
        }
Run Code Online (Sandbox Code Playgroud)

注意:它在Swift 2.2中运行.我在迁移到Swift 3之后才遇到这个崩溃.任何想法!

小智 10

是!zsteed的回答有效

添加到您的Info.plist:

<key>NSCameraUsageDescription</key>
<string>Allow us to scan documents and capture images.</string>
Run Code Online (Sandbox Code Playgroud)