条形码扫描器在生产模式下不会返回响应

时间:2018-02-21 06:57:12

标签: react-native expo

设备:iPhone 6s +(v11.2.5)

我的应用正在使用Expo https://docs.expo.io/versions/latest/sdk/bar-code-scanner.html

在世博会申请(开发)中。条形码扫描仪工作正常。但是,当我们在TestFlight上传它并下载应用程序时。条形码扫描仪不再工作,即使我允许它使用相机。

<View style={styles.container}>
    {this.state.hasCameraPermission === null
      ? <Text>Requesting for camera permission</Text>
      : this.state.hasCameraPermission === false
          ? <Text style={{ color: '#fff' }}>
              Camera permission is not granted
            </Text>
          : <BarCodeScanner
              onBarCodeRead={this._handleBarCodeRead.bind(this)}
              style={{
                height: Dimensions.get('window').height,
                width: Dimensions.get('window').width,
              }}
            />}
  </View>

_handleBarCodeRead = result => {
 if (this.state.lastScannedUrl !== result.data) {
  this.setState({
    lastScannedUrl: result.data
  })

  if (this.props.inventories.inventory.length > 0) {
    let item = (this.props.inventories.inventory).find(element => {
      return element.id == result.data
    })

    if (item !== undefined) {
      Actions.viewItem({inventory: item, route: this.state.route})
    } else {
      Alert.alert(
        'Alert',
        'No item found',
        [
          {text: 'Back', onPress: () => Actions.pop(), style: 'cancel'},
          {text: 'Search Again', onPress: () => this.setState({lastScannedUrl: null})},
        ],
        { cancelable: true }
      )
    }
  }
 }
}

任何帮助将不胜感激。感谢

0 个答案:

没有答案