Error permisions of Microphone
i got this fatal error ´´´Swift fatalError("[CameraEngine] error initInputDevice") ´´´
And i print put the error, it was this one: Error Domain=AVFoundationErrorDomain Code=-11852 "Cannot use iPod Microphone" UserInfo={NSLocalizedDescription=Cannot use iPod Microphone, AVErrorDeviceKey=<AVCaptureFigAudioDevice: 0x14f66450 [iPod Microphone][com.apple.avfoundation.avcapturedevice.built-in_audio:0]>, NSLocalizedFailureReason=This app is not authorized to use iPod Microphone.}
I know I have tuned off the microphone permissions, but this error should not occur if I will only use the camera without video.
for testing I will turn on the microphone, but I should be able to take photos without this permission
Permission error ! Thanks for reporting again, your contribution is awesome thanks again. I will check it out.
you could add also the permisions promp like a function .askCameraPermision(callback) .askCameraPermision(callback)
also variables to know if it has pemission of the AVFoundation, check the library CameraManager for some inspiration 😄
@davidlondono Thanks I am currently working on it. I will provide a fix soon. Thanks again for your help. It makes CameraEngine so much better !
@davidlondono how did you fix the error? It still occurs for me when user cancels permission for mic or camera. Which would have been fine except that the error occurs when I initialize camera engine let cameraEngine = CameraEngine() which means before I get the chance to ask for permission again, the fatal error will occur. This is bad when your initial view controller is displaying a camera.
just check if camera is available manually with UIKit and then if it is available create the CameraEngine instance
@davidlondono That means I can't have a global instance of cameraEngine declared. I would have to initialize it in every function I create that manipulates cameraEngine - Unless I'm wrong and there is a way I can do this at the top of my class?
if AVCaptureDevice.authorizationStatusForMediaType(AVMediaTypeVideo) == AVAuthorizationStatus.Authorized
{
let cameraEngine = CameraEngine()
}
or create a class with a static function and static variable of CameraEngine, on the function return an optional CameraEngine and return nil if is not authorized