Expo BarCodeScanner 如果用户拒绝相机权限程序无法再次询问

Expo BarCodeScanner if the user denies camera permission program is unable to ask again

使用 Expo BarCodeScanner 时,一旦用户在 requestPermissionsAsync() 调用后拒绝所需的相机权限,将始终 return 'denied'.

来自世博会documentation;

Often you want to be able to test what happens when a user rejects a permission, to ensure that it has the desired behavior. An operating-system level restriction on both iOS and Android prohibits an app from asking for the same permission more than once (you can imagine how this could be annoying for the user to be repeatedly prompted for permissions). So in order to test different flows involving permissions in development, you may need to uninstall and reinstall the Expo Go app. In the simulator this is as easy as deleting the app, and expo-cli will automatically install it again next time you launch the project.

但是,您并不总是需要删除应用程序并重新安装。您也可以通过进入设置和应用程序权限手动授予权限。