【问题标题】:Expo's BarCodeScanner crashes when sacaning using the build使用构建进行扫描时,Expo BarCode Scanner 崩溃
【发布时间】:2019-09-11 11:31:29
【问题描述】:

使用 Expo 的 BarCodeScanner 扫描条形码时应用程序崩溃

我对编程和展览很陌生,所以我提前为缺乏精确度道歉。
我使用 Expo 34.0.1 创建了一个应用程序,我使用了expo’s expo-barcode-scanner。该应用程序在expo start 上完美运行;但是,当我运行expo build:android 时,扫描失败。相机会打开,但只要扫描到代码,应用就会重新启动。

(我没有在IOS上测试过)

"expo": "^34.0.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
"sdkVersion": "33.0.0",
import { BarCodeScanner } from 'expo-barcode-scanner';
import * as Permissions from 'expo-permissions';
<BarCodeScanner
        onBarCodeScanned={this.handleBarCodeScanned}
        style={StyleSheet.absoluteFill}
>
</BarCodeScanner>

我希望它可以像在开发中一样工作,但应用程序会在扫描代码后立即重新启动

谢谢!

【问题讨论】:

    标签: android react-native build expo barcode-scanner


    【解决方案1】:

    问题在于您的权限是如何设置的。您需要检查从哪里调用您的权限。我从 componentWillMount() 调用我的

    【讨论】:

    • 成功了!我永远无法猜到这是问题所在,老实说,我最初认为这个解决方案行不通,因为该应用程序实际上打开了相机并且它在开发中工作。非常感谢! (顺便说一句,我的权限是从 componentDidMount() 调用的)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-19
    • 2012-12-17
    • 1970-01-01
    • 2018-10-13
    • 1970-01-01
    相关资源
    最近更新 更多