[英]AVCaptureSession startRunning exc_bad_access iOS 10 Swift 3
I'm having an exc_bad_access crash when starting an AVCaptureSession: 我在启动AVCaptureSession时遇到了exc_bad_access崩溃:
if captureSession.isRunning == false {
captureSession.startRunning()
}
Notice: It was working in Swift 2.2. 注意:它在Swift 2.2中运行。 I'm having this crash only after migration to Swift 3. Any idea!
我在迁移到Swift 3之后才遇到这个崩溃。任何想法!
As @karnett & @zsteed mentioned I had to add the camera privacy description to info.plist 正如@karnett和@zsteed所提到的,我必须将相机隐私描述添加到info.plist
To add it to info.plist source code add those 2 lines: 要将它添加到info.plist源代码,请添加以下两行:
<key>NSCameraUsageDescription</key>
<string>Allow us to scan images for QRCode.</string>
Or add new string item in the Property list, the key should be 或者在属性列表中添加新的字符串项,键应该是
Privacy - Camera Usage Description
and the value will be your description when the user will be asked to give permission for camera. 当用户被要求给予摄像机许可时,该值将是您的描述。 Same as the screenshot below:
与下面的屏幕截图相同:
This will let the system ask the user whether they allow us to use the camera. 这将让系统询问用户是否允许我们使用相机。
Thank you 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.