简体   繁体   English

相机未在 React-native-qr-code-scanner 中授权

[英]camera not authorized in React-native-qr-code-scanner

Not able to see camera in React-native-qr-code-scanner, instead of camera it is showing camera not authorized text.无法在 React-native-qr-code-scanner 中看到摄像头,而不是摄像头,而是显示摄像头未授权文本。 I am using the same code which is there in npm react native qr code scanner documentation.我正在使用与 npm 中的相同代码反应本机二维码扫描仪文档。 I have tested in many devices.我已经在许多设备上进行了测试。

I encountered the same problem it's last days...... 我最近遇到了同样的问题……

1/ npm uninstall react-native-camera 1 / npm卸载react-native-camera
2/ install a specific version of react-native-camera like this: npm install react-native-camera@1.10.1 2 /安装特定版本的react-native-camera,如下所示: npm install react-native-camera@1.10.1
3/the version in your package.json should look like this: "react-native-camera": "1.10.1" 3 / package.json中的版本应如下所示: “ react-native-camera”:“ 1.10.1”
4/ re-test 4 /重新测试

this has worked for me. 这对我有用。

You can solve this issue in iOS by doing the following您可以通过执行以下操作在 iOS 中解决此问题

  1. Change the versions更改版本
"react-native-qrcode-scanner": "^1.5.4",
"react-native-permissions": "^3.0.5",
"react-native-camera": "3.44.3",
  1. Info.plist信息列表
<key>NSCameraUsageDescription</key>
<key>NSPhotoLibraryUsageDescription</key>
  1. Pod file吊舱文件
permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'react-native-camera', :path => '../node_modules/react-native-camera'
  1. yarn and pod install纱线和吊舱安装

Build app again it will work再次构建应用程序它将起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM