Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aimilne opened this issue Dec 2, 2024 · 1 comment

Comments

@aimilne
Copy link

aimilne commented Dec 2, 2024

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!

@guatedude2
Copy link

guatedude2 commented Jan 18, 2025

Are you using OTA? I found out that when I added expo-updates this started happening to me. This usually happens when it can't find the model files

I tested this again, and looks like it isn't the location of the model

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants