moaazsidat / react-native-qrcode-scanner

A QR code scanner component for React Native.
MIT License
2.04k stars 516 forks source link

Must give NSMicrophoneUsageDescription #166

Open handoff opened 5 years ago

handoff commented 5 years ago

What's happening?

Just upgraded the package, and now the app crashes with log text

This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSMicrophoneUsageDescription key with a string value explaining to the user how the app uses this data.

Howcome the scanner needs the microphone? I think many users will think this is kind of fishy. Can this requirement be disabled?

How can it be reproduced?

I am just doing

<QRCodeScanner
    onRead={this.onSuccess.bind(this)}
    reactivate
    reactivateTimeout={1000}
    showMarker
/>

Build details?

"react-native-camera": "^1.8.0"
"react-native-qrcode-scanner": "^1.1.2"
jinchung commented 5 years ago

This is due to changes in the react-native-camera package. For the full fix, you need to add the NSMicrophoneUsageDescription key as mentioned above and then set the cameraProps={{captureAudio: false}} as noted in https://github.com/moaazsidat/react-native-qrcode-scanner/issues/160

afilp commented 5 years ago

@jinchung We have the same problem. Can you please use the solution provided below, as there is no reason for a qr code scanner to trigger the microphone permissions?

Instead of checkDeviceAuthorizationStatus have you tried checkVideoAuthorizationStatus? This seems to prompt for just the Camera Access and not the microphone.

Source: https://github.com/react-native-community/react-native-camera/issues/446

andrewxhill commented 5 years ago

I had the same issue in https://github.com/airsecure/airsecure and didn't want to create all the extra permissions fields for our users to worry about, so created this fork of the permissions library that will only work for camera and therefore, only requires the camera justification https://github.com/textileio/react-native-permissions

afilp commented 5 years ago

@andrewxhill Thanks! I wonder if this could be a setting (option) in this package or at the react-native-permissions package, what do you think?