Hello All,
i am ussing ZXing.Mobile plugin on my Xamarin.iOS app. i have a metthod that tries to scan a barcode. strange thing is that when i call that method containing await scanner.Scan(), on my login screen, it pops up the camera whereas if i call the same method on another view controller, it doesnt pop up the camera and doenst even give any error.
`
var cameraPermission = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Camera); if (cameraPermission != PermissionStatus.Granted) { if (await CrossPermissions.Current.ShouldShowRequestPermissionRationaleAsync(Permission.Camera)) { //await Application.Current.MainPage.DisplayAlert("Camera Unavailable", Constants.AppName + " requires the camera permission", "OK"); } var results = await CrossPermissions.Current.RequestPermissionsAsync(new[] { Permission.Camera }); cameraPermission = results[Permission.Camera]; if (cameraPermission != PermissionStatus.Granted) { AppDelegate.DisplayAlertMsg(this, "Camera permission not granted, kindly go to settings and grant the permission to continue!"); return; } } MobileBarcodeScanner scanner = new MobileBarcodeScanner(); //Start scanner.AutoFocus(); scanner.CameraUnsupportedMessage = "Unable to start the camera"; var result = await scanner.Scan(); if (result != null) { } return;
`
i cant see what could be causing this behaviour as the code contains hardly few lines and im using same code on both screens.
please help.
regards,
Atin..
Answers
I can't be able to reproduce your issue , if possible could you provide us a baisc, mini project here to test ?