Reputation: 163
I'm having an exc_bad_access crash when starting an AVCaptureSession:
if captureSession.isRunning == false {
captureSession.startRunning()
}
Notice: It was working in Swift 2.2. I'm having this crash only after migration to Swift 3. Any idea!
Upvotes: 4
Views: 2114
Reputation: 16609
As @karnett & @zsteed mentioned I had to add the camera privacy description to info.plist
To add it to info.plist source code add those 2 lines:
<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
Upvotes: 0