Dart / Flutter:iOS应用程序因Firebase ML Vision而崩溃

时间:2018-08-12 04:02:58

标签: dart flutter

我正在创建一个Flutter应用程序,该应用程序使用相机插件拍摄图像,然后对其进行处理。我正在使用Firebase ML Vision程序包来处理这些图像,但是当我在iPhone上运行该应用程序时,它会崩溃。

Here's an image of the stack trace

Here's an image of when I run "flutter doctor -v"

相关代码:

fetchImageAnnotations(File image) async {
    final FirebaseVisionImage visionImage = 
    FirebaseVisionImage.fromFile(image);
    final BarcodeDetector barcodeDetector = 
    FirebaseVision.instance.barcodeDetector();
    final LabelDetector labelDetector = 
    FirebaseVision.instance
    .labelDetector(LabelDetectorOptions(confidenceThreshold: 0.80));
    final TextDetector textDetector = 
    FirebaseVision.instance.textDetector();

    final List<Barcode> barcodes = await barcodeDetector.detectInImage(visionImage);
    final List<Label> labels = await labelDetector.detectInImage(visionImage);
    final List<TextBlock> blocks = await textDetector.detectInImage(visionImage);
}

如果有人可以提供帮助,将不胜感激。

1 个答案:

答案 0 :(得分:0)

您是否检查了 iOS 权限?您需要添加:

<key>NSCameraUsageDescription</key>
<string>Can I use the camera please?</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Can I use the photos library please?</string>

到plist