Skip to content

Uncaught exception 'MLKInvalidLocalModel' on launch using custom model in iOS Expo preview/production build #177

Closed
@aimilne

Description

@aimilne

We are getting a crash using a custom object detection model on iOS, that only occurs in an expo preview/production build (i.e. it is working well when the model is being packaged by metro running locally, and it works on all Android builds). The crash is happening on every launch.

We are using react-native-mlkit-object-detection 2.0.1 on expo 51. The code is set up following instructions here and the model is this one

The crash occurs when useObjectDetectionModels is called

iOS console logs:

*** Terminating app due to uncaught exception 'MLKInvalidLocalModel', reason: 'Local model path (/var/mobile/Containers/Data/Application/87E07E3F-933C-47A3-928E-EE6A993D04C4/Library/Application%20Support/.expo-internal/f171bf76b0f73d7ed4b9e1c238e3128f.tflite) is invalid.'

Stack Trace: (
    "0   CoreFoundation                      0x00000001892d8f2c 00E76A98-210C-3CB5-930B-F236807FF24C + 540460",
    "1   libobjc.A.dylib                     0x000000018118e018 objc_exception_throw + 60",
    "2   CoreFoundation                      0x00000001893d76dc 00E76A98-210C-3CB5-930B-F236807FF24C + 1582812",
    "3   birdadev                            0x0000000100f444e8 -[MLKCustomObjectDetectorOptions initWithRemoteModel:localModel:] + 276",
    "4   birdadev                            0x0000000100f4403c -[MLKCustomObjectDetectorOptions initWithLocalModel:] + 76",
    "5   birdadev                            0x00000001023c962c $sSo30MLKCustomObjectDetectorOptionsC10localModelABSo08MLKLocalF0C_tcfcTO + 36",
    "6   birdadev                            0x00000001023c8fa4 $sSo30MLKCustomObjectDetectorOptionsC10localModelABSo08MLKLocalF0C_tcfC + 44",
    "7   birdadev                            0x00000001023c8efc $s22RNMLKitObjectDetection0a6CustomB15DetectorOptionsC20createWithLo<…>

Any help appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions