简体   繁体   English

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

[英]Dart/Flutter: iOS app crashes with Firebase ML Vision

I'm creating a Flutter application that uses the camera plugin to take images and then process them.我正在创建一个 Flutter 应用程序,它使用相机插件来拍摄图像然后处理它们。 I'm using the Firebase ML Vision package to process these images, but when I run the app on my iPhone, it crashes.我正在使用 Firebase ML Vision 包来处理这些图像,但是当我在 iPhone 上运行该应用程序时,它崩溃了。

Here's an image of the stack trace这是堆栈跟踪的图像

Here's an image of when I run "flutter doctor -v"这是我运行“flutter doctor -v”时的图像

Relevant Code:相关代码:

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);
}

If anyone can help, that would be greatly appreciated.如果有人可以提供帮助,将不胜感激。

Did you check the iOS permissions?你检查过iOS权限吗? You need to add:您需要添加:

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

To the plist到 plist

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM