-
Notifications
You must be signed in to change notification settings - Fork 704
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
IOS App crash with Null Reference Exception at SetupCaptureSession() #1078
Comments
@jamesingreersc Did you find a solution to this? I'm running into the same issue . |
@spinspin No, I found nothing helpful. I can see that the UINavigationController is null when the scanner is being initialized. I'm not sure if this a bug in .Net or not. I am going to test the old version of the app that does work and see if it's null there or not. |
It's probably a bug. I've just written some native net7.0-ios code which handles barcode scanning so I don't need to use this library let me know if you want it. |
@spinspin That would be awesome if I could use your code. Thanks bunches!! |
@jamesingreersc this should be enough to get going , I'm using MvvmCross but the core functionality to create a barcode scanner is in here public class BarcodeScannerViewController : MvxViewController
|
@spinspin Thanks for this. It helped a bunch! |
I am in the process of updating a native xamarin ios app to a Microsoft.IOS .Net 6 app. I am using the ZXing.Net6.Mobile nuget which I used to replace the older ZXing.Net.Mobile .
The code being used was seamless as far as building but I am getting a null reference exception when calling the .Scan method. It's crashing all the way back to the Main application file. Just before the crash the camera does try to open.
This is the stack trace I am getting
object reference not set to instance of an object
at ZXing.Mobile.ZXingScannerView.SetupCaptureSession()
at ZXing.Mobile.ZXingScannerView.b__42_0()
at Foundation.NSActionDispatcher.Apply()
at Foundation.NSObject.InvokeOnMainThread(Action )
at ZXing.Mobile.ZXingScannerView.StartScanning(Action`1 scanResultHandler, MobileBarcodeScanningOptions options)
at ZXing.Mobile.ZXingScannerViewController.b__33_1()
at Foundation.NSAsyncActionDispatcher.Apply()
at UIKit.UIApplication.UIApplicationMain(Int32 , String[] , IntPtr , IntPtr )
at UIKit.UIApplication.Main(String[] , Type , Type )
at DSDRouteManager.iOS.Application.Main(String[] args) in /Users/jamespridgen/Desktop/DSDRouteManager/DSDRouteManager.IOS/Main.cs:line
These are the keys I have in Info.plist
NSCameraUsageDescription
Can we use your camera
Privacy - Camera Usage Description
Taking picture barcode
Privacy - Photo Library Usage Description
Taking picture barcode
This is the code I am using to call the camera
The text was updated successfully, but these errors were encountered: