I'm creating a Flutter application that uses the camera plugin to take images and then process them. I'm using the Firebase ML Vision package to process these images, but when I run the app on my iPhone, it crashes.

Here's an image of the stack trace

Here's an image of when I run "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.


Solution 1: Theuno de Bruin

Did you check the iOS permissions? 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

If this is already in the plist, run the iOS project directly from xcode why its crashing on startup