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

问题描述 投票:3回答:0

设备: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 }
      )
    }
  }
 }
}

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

react-native expo
© www.soinside.com 2019 - 2024. All rights reserved.