NeutrinosPlatform / cordova-plugin-document-scanner

cordova plugin for document scan
https://www.neutrinos.co/
MIT License
85 stars 61 forks source link

[iOS Only]: refuse camera permissions leads to crashes #78

Open Gollm opened 4 years ago

Gollm commented 4 years ago

Describe the bug When you refuse the permission for camera-usage, the app crashed, when you try to scan. This is only at ios. Android asks each time for permission and refuse camera-usage, if it have to. Additionally, it is still possible to scan a document in that moment, you refuse it.

To Reproduce Steps to reproduce the behavior:

  1. Refuse Camera permissions
  2. Try to scan

Expected behavior Like Android, ask again for granting permissions and deny, if it have to.

Smartphone (please complete the following information): (Tested ones)

Additional context Xcode Crash Error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[AVCaptureSession addInput:] Can't add a nil AVCaptureInput'

ChrisTomAlx commented 4 years ago

Hey @Gollm

Thanks for raising this issue. By default iOS won't let you ask the user again for permission. Its a one time thing. If the user denies permission, they will have to manually go in to settings and change the permission.

But you are right the scan shouldn't start if the permission was denied. I am not sure when I will be able to take a look at this issue but for now as a workaround you could use the diagnostic cordova plugin to request for permission and then once user has given permission run the scan command

Cheers and have a nice day :) Chris Neutrinos

Gollm commented 4 years ago

Thank you for your very fast response! :)