App crashing on try to scan on IOS
See original GitHub issueHello guys,
I just wanted to implement the Scanner in my App, but everytime i try to scan the app crash. So i tried it with the sample app and here its not working too.
This is the Exception output.
An error occurred: 'Could not create an native instance of the type 'Firebase.MLKit.Vision.VisionImageMetadata': the native class hasn't been loaded.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.'. Callstack: ' at Foundation.NSObject.InitializeObject (System.Boolean alloced) [0x0002e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:312
at Foundation.NSObject..ctor (Foundation.NSObjectFlag x) [0x0000d] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:180
at Firebase.MLKit.Vision.VisionImageMetadata..ctor () <0x12288e5c8 + 0x00008> in <8607cf18847b4467a58b3fd7d84f75f1>:0
at GoogleVisionBarCodeScanner.UICameraPreview+CaptureVideoDelegate..ctor (GoogleVisionBarCodeScanner.Renderer.CameraViewRenderer renderer) [0x0002f] in C:\Users\Kliem\source\repos\Sample\BarcodeScanner.XF\GoogleVisionBarCodeScanner\iOS\UICameraPreview.cs:288
at GoogleVisionBarCodeScanner.UICameraPreview.Initialize (GoogleVisionBarCodeScanner.Renderer.CameraViewRenderer renderer) [0x000cb] in C:\Users\Kliem\source\repos\Sample\BarcodeScanner.XF\GoogleVisionBarCodeScanner\iOS\UICameraPreview.cs:182
at GoogleVisionBarCodeScanner.UICameraPreview..ctor (GoogleVisionBarCodeScanner.Renderer.CameraViewRenderer renderer, GoogleVisionBarCodeScanner.CameraFacing cameraFacing, GoogleVisionBarCodeScanner.CaptureQuality captureQuality) [0x00016] in C:\Users\Kliem\source\repos\Sample\BarcodeScanner.XF\GoogleVisionBarCodeScanner\iOS\UICameraPreview.cs:35
at GoogleVisionBarCodeScanner.Renderer.CameraViewRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1[TElement] e) [0x0006b] in C:\Users\Kliem\source\repos\Sample\BarcodeScanner.XF\GoogleVisionBarCodeScanner\iOS\Renderer\CameraViewRenderer.cs:32
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00172] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:296
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:158
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00032] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:240
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:119
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:51
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x0012e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:283
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:158
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00032] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:240
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:119
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:51
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x0012e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:283
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:158
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00032] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:240
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:119
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:51
at Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidLoad () [0x0008f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:251
at (wrapper managed-to-native) ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper(intptr,intptr)
at UIKit.UIViewController.get_View () [0x0002a] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/ios/native/UIKit/UIViewController.g.cs:2844
at Xamarin.Forms.Platform.iOS.PageRenderer.get_NativeView () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:103
at Xamarin.Forms.Platform.iOS.PageRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0003d] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:119
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00032] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:240
at Xamarin.Forms.Platform.iOS.NavigationRenderer.CreateViewControllerForPage (Xamarin.Forms.Page page) [0x00008] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:374
at Xamarin.Forms.Platform.iOS.NavigationRenderer.OnPushAsync (Xamarin.Forms.Page page, System.Boolean animated) [0x0001d] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:352
at Xamarin.Forms.Platform.iOS.NavigationRenderer.<ViewDidLoad>b__47_0 (Xamarin.Forms.Page p) [0x00024] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:239
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
at (wrapper delegate-invoke) <Module>.invoke_void_object(object)
at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSAction.cs:178
--- End of stack trace from previous location where exception was thrown ---
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.Type principalClass, System.Type delegateClass) [0x00047] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:79
at SampleApp.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\Kliem\source\repos\Sample\BarcodeScanner.XF\SampleApp\SampleApp.iOS\Main.cs:17
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395 '
I figured out that when i am builduing the app, this output is shown:
Skipping invalid framework FirebaseCore.framework. Reason: Invalid executable obj\iPhone\Debug\device-builds\iphone9.3-15.1/Frameworks\FirebaseCore.framework\FirebaseCore (Aufgaben-ID: 80)
2> Skipping invalid framework FirebaseCoreDiagnostics.framework. Reason: Invalid executable obj\iPhone\Debug\device-builds\iphone9.3-15.1/Frameworks\FirebaseCoreDiagnostics.framework\FirebaseCoreDiagnostics (Aufgaben-ID: 80)
2> Skipping invalid framework GoogleDataTransport.framework. Reason: Invalid executable obj\iPhone\Debug\device-builds\iphone9.3-15.1/Frameworks\GoogleDataTransport.framework\GoogleDataTransport (Aufgaben-ID: 80)
2> Skipping invalid framework FirebaseInstallations.framework. Reason: Invalid executable obj\iPhone\Debug\device-builds\iphone9.3-15.1/Frameworks\FirebaseInstallations.framework\FirebaseInstallations (Aufgaben-ID: 80)
2> Skipping invalid framework FirebaseInstanceID.framework. Reason: Invalid executable obj\iPhone\Debug\device-builds\iphone9.3-15.1/Frameworks\FirebaseInstanceID.framework\FirebaseInstanceID (Aufgaben-ID: 80)
2> Skipping invalid framework TFLTensorFlowLite.framework. Reason: Invalid executable obj\iPhone\Debug\device-builds\iphone9.3-15.1/Frameworks\TFLTensorFlowLite.framework\TFLTensorFlowLite (Aufgaben-ID: 80)
2> Skipping invalid framework GoogleAppMeasurement.framework. Reason: Invalid executable C:\Users\Kliem\AppData\Local\XamarinBuildDownloadCache\GAppM-6.9.0\Frameworks\GoogleAppMeasurement.framework\GoogleAppMeasurement (Aufgaben-ID: 80)
2> Skipping invalid framework FirebaseMLCommon.framework. Reason: Invalid executable C:\Users\Kliem\AppData\Local\XamarinBuildDownloadCache\FMLCmmn-0.21.0\Frameworks\FirebaseMLCommon.framework\FirebaseMLCommon (Aufgaben-ID: 80)
2> Skipping invalid framework TensorFlowLiteC.framework. Reason: Invalid executable C:\Users\Kliem\AppData\Local\XamarinBuildDownloadCache\TnsrFlwLtC-2.3.0\TensorFlowLiteC-2.3.0\Frameworks\TensorFlowLiteC.framework\TensorFlowLiteC (Aufgaben-ID: 80)
2> Skipping invalid framework FirebaseMLVision.framework. Reason: Invalid executable C:\Users\Kliem\AppData\Local\XamarinBuildDownloadCache\FMLVsn-0.21.0\Frameworks\FirebaseMLVision.framework\FirebaseMLVision (Aufgaben-ID: 80)
2> Skipping invalid framework FirebaseMLVisionAutoML.framework. Reason: Invalid executable C:\Users\Kliem\AppData\Local\XamarinBuildDownloadCache\FMLVsnA-0.21.0\Frameworks\FirebaseMLVisionAutoML.framework\FirebaseMLVisionAutoML (Aufgaben-ID: 80)
2> Skipping invalid framework FirebaseMLVisionBarcodeModel.framework. Reason: Invalid executable C:\Users\Kliem\AppData\Local\XamarinBuildDownloadCache\FMLVsnB-0.21.0\Frameworks\FirebaseMLVisionBarcodeModel.framework\FirebaseMLVisionBarcodeModel (Aufgaben-ID: 80)
2> Skipping invalid framework FirebaseMLVisionFaceModel.framework. Reason: Invalid executable C:\Users\Kliem\AppData\Local\XamarinBuildDownloadCache\FMLVsnF-0.21.0\Frameworks\FirebaseMLVisionFaceModel.framework\FirebaseMLVisionFaceModel (Aufgaben-ID: 80)
2> Skipping invalid framework FirebaseMLVisionLabelModel.framework. Reason: Invalid executable C:\Users\Kliem\AppData\Local\XamarinBuildDownloadCache\FMLVsnL-0.21.0\Frameworks\FirebaseMLVisionLabelModel.framework\FirebaseMLVisionLabelModel (Aufgaben-ID: 80)
2> Skipping invalid framework FirebaseMLVisionTextModel.framework. Reason: Invalid executable C:\Users\Kliem\AppData\Local\XamarinBuildDownloadCache\FMLVsnT-0.21.0\Frameworks\FirebaseMLVisionTextModel.framework\FirebaseMLVisionTextModel (Aufgaben-ID: 80)
2> Skipping invalid framework FirebaseMLVisionObjectDetection.framework. Reason: Invalid executable C:\Users\Kliem\AppData\Local\XamarinBuildDownloadCache\FMLVsnO-0.21.0\Frameworks\FirebaseMLVisionObjectDetection.framework\FirebaseMLVisionObjectDetection (Aufgaben-ID: 80)
2>
Can someone help me?
Issue Analytics
- State:
- Created 2 years ago
- Comments:23 (7 by maintainers)
Top Results From Across the Web
If an app on your iPhone or iPad stops responding, closes ...
If an app on your iPhone or iPad stops responding, closes unexpectedly, or won't open ; Close and reopen the app. Force the...
Read more >10 Fixes for When Your iPhone Apps Keep Crashing
In this case, try exiting the app completely before relaunching it. Access the App Switcher, swipe to the opened app, and swipe up...
Read more >iphone app crashing when trying to scan passport
Attempting to go through the Travel Ready center, when I press "scan passport" the app terminates. When I press "scan later" and attempt...
Read more >App crashing on try to scan on IOS · Issue #100
Hello guys, I just wanted to implement the Scanner in my App, but everytime i try to scan the app crash. So i...
Read more >How to Fix Crashing Apps on iPhone & iPad
The best approach for app crashing issues is to try to force reboot the iPhone or iPad by holding down the Power button...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi Thank you for your support. I directly deploy from Windows to iOS local device (not Pair to Mac or Remote Device). I tried that workabout but did not solve the problem. This will probably be the problem. I faced may be something very similar to this when I was using maps from Google. I will use VS on my Mac instead. Thank you
Hi, I have just done some research against this issue recently and it seems it has a possible workaround. I guess you are using Windows and deploy to iPhone with Pair-to-Mac features and hot-restart.
To be short, you may try to copy the code from https://gist.github.com/mattjohnsonpint/37d3ac06a563c41618fc933bf7282d66 to your maui project .csproj, paste it with the <Project> </Project> and try to rebuild it again. Or as an alternative, build and deploy to iOS directly by the latest Visual studio for Mac.
For others related articles, please see if below could help you… https://github.com/dotnet/maui/issues/10800#issuecomment-1301564278 https://supportcenter.devexpress.com/ticket/details/t1121521/maui-the-could-not-create-an-native-instance-error
Any feedback would be appreciate