Giter Site home page Giter Site logo

jimmypun610 / barcodescanner.mobile Goto Github PK

View Code? Open in Web Editor NEW
314.0 20.0 92.0 40.38 MB

Barcode Scanner using GoogleVision API for Xamarin Form, Maui

License: MIT License

C# 100.00%
xamarin-forms barcode-scanner qrcode barcode googlemobilevision qrcode-reader qrcode-scanner barcode-reader xamarin mlkit

barcodescanner.mobile's Introduction

BarcodeScanner.Mobile

Powerful barcode scanning library using Google MLKit API. For MAUI and Xamarin Forms. Please feel free to improve my source code.

Supported versions

  • Xamarin Forms: iOS 12+ and Android (MonoAndroid13.0)
  • Maui : iOS 15.4+ and Android (android 34.0) .net 8

Current Version

  • Xamarin Forms - 6.3.1
  • Maui - 8.0.21

Release notes

https://github.com/JimmyPun610/BarcodeScanner.Mobile/tree/master/ReleaseNotes

Installation and usage

Please refer to Wiki

barcodescanner.mobile's People

Contributors

andrian-kr avatar benjamingranados avatar criistii avatar criistii-toptal avatar cvd442 avatar giampaologabba avatar iliopoulosd avatar jake-derrick avatar jimmypun610 avatar kenkosmowski avatar kennydizi avatar laboss avatar moret84 avatar mos379 avatar mpapadis avatar stef-halmans avatar stepkillah avatar sylvainmoingeon avatar trung1250 avatar victorkochetkov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

barcodescanner.mobile's Issues

Remove Plugin.Permission

Hi, the new version of Xamarin.Essentials has a new permissions implementation, you should remove Plugin.Permission (so I can remove mine).

Thanks,
Dottor Pagliaccius

Changes to GoogleVisionBarCodeScanner not picked up because SampleApp references NuGet instead of project

Hello - I'd very much like to add some features for your consideration. However, the SampleApp references the NuGet package, rather than the GoogleVisionBarCodeScanner project.

I don't have much experience in this area. How can I either create a NuGet package from the code in my version of the GoogleVisionBarCodeScanner project, or have the SampleApp refer to the project in the solution? I tried to remove the package reference, but ended up missing more things than I expected.

Any help is appreciated, thanks!

Debug SampleApp.Android error

Hi, i cloned the repo and when trying to debug the SampleApp.Android i get following error :
Java.Lang.RuntimeException: 'Fail to connect to camera service'

Any ideas?

Thanks!

Building iOS project fails

Building iOS project with linking SDK only fails when using Forms 4.6.0.726

error MT2002: Failed to resolve "Xamarin.Forms.Platform.iOS.RadioButtonRenderer" reference from "Xamarin.Forms.Platform.iOS, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null

Seems related to the issue with Forms 4.5

Random OnDetected invoked when not actively scanning QR codes

Hi there! Thanks for what appears to be a great QR code scanner ๐Ÿ‘ one issue I noticed however is I have a tabbed page with 2 child pages, one happens to be a page with a QR code scanner view in it to scan items and another page has scanned barcodes. I noticed randomly that on the scanned barcodes page the app/device randomly vibrated and scanned as though it was scanning a barcode but I didn't even have a barcode being scanned in front of the device. I put break point in on the OnDetected event method to see the result and looks like following:

Capture

It seems rather odd it would randomly trigger the QR code OnDetected event. Would there be a reason for this since I don't even have a QR code in front of the camera?

version 4.8.0 and above android main activity init issue and MVVM

First of all, thank you for this great work.

in version 4.7 and below, for the android MainActivity ,
the GoogleVisionBarCodeScanner.Droid.RendererInitializer.Init(); method works.
but after 4.8.0 and above, i couldnt find how to init the scanner for android.

And how can i implement this library with MVVM?
OnDetected event doesnt support binding to MVVM.
thank you

Issue with connection to PRISM EventToCommandBehavior

| found an issue with connection of CameraView.OnDetected event to PRSIM EventToCommandBehavior - now is not possible to pass BarcodeResults as parameter to command.Execute method cuz EventToCommandBehavior requires that data provided via public property

This issue very easy to fix - to change BarcodeResults to property:

`public class OnDetectedEventArg : EventArgs
{
public List BarcodeResults { get; set; }

    public OnDetectedEventArg()
    {
        BarcodeResults = new List<BarcodeResult>();
    }
}`

Code 39 Not Working

Everything works great other than barcode type code 39 on Andriod. Also very excited about the future of this project. Hope this can be resolved.

Error- System.NotSupportedException Message=Unable to activate instance of type Android.Util.SparseArray`1[E] from native handle 0x11 (key_handle 0xd807fbf).

I replicated your SampleApp code and when I press the 'start scanning' button for page 3 i.e. continous scanning and run it in the debugging mode on my device the app breaks and I get the following error in VS Code 2019

System.NotSupportedException
Message=Unable to activate instance of type Android.Util.SparseArray`1[E] from native handle 0x11 (key_handle 0xd807fbf).

Can you please help me solve this issue.

CameraView_OnDetected not firing

Hi Jimmy,

I downloaded your sample project and for some reason CameraView_OnDetected is not firing. I am trying to scan QR code using Nokia 5 with Android 9. Also, if i click scan from image button, it freezes. It did ask me for permissions to access camera and storage. Any idea what could be the problem?

Thanks!

Dario

Multiple scans

I am trying to scan more than once, I mean if I have setted a parameter, the app will allow or not to scan another code, the functionality would be similar to a picking system.

It would be nice the libabry would allow multiple scans

iOS: ipa file size too large

Hello there.
Is anyone face large ipa file size problem? After add BarcodeScanner.XF, my ipa file increase size from 12MB to 69MB, linker behavior already set to Link SDK, Solution Configuration set to Release, Solution Platform set to iPhone
When I upload to AppStore, the ipa file got rejected.
Any solution?
Thanks.

Enable/Disable scanning by App

I would very much like to have the possibility to start my App with the CameraView visible but scanning being disabled and later enabled on some UI interaction like tapping and disabled again.

Use case:
Think of an App scanning tickets. At the moment, when you display the CameraView and by chance some arbitrary barcode(s) is (are) seen by the phone's camera: it will immediately be scanned and some business processes will start...
I would propose to change GoogleVisionBarCodeScanner.Methods.Reset to .Enable and .Disable instead.
This way it would also be possible to hide the cameraview to save some battery power, enable it again w/o immediately scanning some barcodes lying around, tapping the display and then scan.

My workaround isn't too nice: disabling vibrate and ignoring every other scan where number of taps modulo 2 != 0.

Error when running scand view

Hello,
Implement the latest version and I get the following error when running on an Android Api 28 Android 9

Xamarin Forms Version: 4.4.0.991864

I have Visual Studio 2019, download the repository and run the example and I get the same error

System.NotSupportedException
Message=Unable to activate instance of type Android.Util.SparseArray`1[E] from native handle 0x19 (key_handle 0xd3578f4).

image

image

image

Could you help me

When to call torch function ?

Hi

When the scanview is done loading there is no event to start the toggle of the camera.
Following your example i had to adapt like this else the toggleflashlight would throw a nullreferenceexception.

        public MainPage()
        {
            InitializeComponent();
            Task.Run(async() =>
            {
                await Task.Delay(5000);
                GoogleVisionBarCodeScanner.Methods.ToggleFlashlight();
            });
        }

        private async void CameraView_OnDetected(object sender, GoogleVisionBarCodeScanner.OnDetectedEventArg e)
        {
            List<GoogleVisionBarCodeScanner.BarcodeResult> obj = e.BarcodeResults;

            string result = string.Empty;
            for (int i = 0; i < obj.Count; i++)
            {
                result += $"{i + 1}. Type : {obj[i].BarcodeType}, Value : {obj[i].DisplayValue}{Environment.NewLine}";
            }
            Device.BeginInvokeOnMainThread(async () =>
            {
                await DisplayAlert("Result", result, "OK");
                //await Navigation.PopModalAsync();
            });
        }

SampleApp: Missing camera permissions

Since Android 6 any app needs runtime permissions.
(see: https://stackoverflow.com/questions/26305107/how-to-fix-fail-to-connect-to-camera-service-exception-in-android-emulator)

In the SampleApp it was missing and the app failed to connect to the camera service.
I added in MainActivity.OnCreate:

            var permission = Android.Support.V4.Content.ContextCompat.CheckSelfPermission(this, Manifest.Permission.Camera);
            if (permission != Android.Content.PM.Permission.Granted)
            {
                Android.Support.V4.App.ActivityCompat.RequestPermissions(this, new string[] { Android.Manifest.Permission.Camera }, 50);
            }

But that is just a quick hack to get the SampleApp up and running.

please help me

Why can't the scanner read this qrcode? Is this an error or unsupported format.
Aฬ‰nh chuฬฃp Maฬ€n hiฬ€nh 2021-03-26 luฬc 09 39 50

SetSupportBarcodeFormat not working on iOS

I'm setting the supported barcodes like this:
GoogleVisionBarCodeScanner.Methods.SetSupportBarcodeFormat(BarcodeFormats.Ean13 | BarcodeFormats.Code39 | BarcodeFormats.Code128 | BarcodeFormats.Itf | BarcodeFormats.Pdf417);

On Android only those types of barcodes are read. But on iOS QR codes are also registered. Actually other barcodes types also get registered. Like Data matrix, ISBN for example. So my guess is that on iOS SetSupportBarcodeFormat is not having effect.

I was able to reproduce this issue on the sample app (adding SetSupportBarcodeFormat of course).

Tested on: iPhone XR 14.4.2, iPhone 12 Pro 14.4.2 & iPhone 6s Plus 13.7

Changing VibationOnDetected is ignored in the app's lifecycle

I would like to let the phone vibrate if my business processes greenlight the scanned barcode.
If the barcode is not accepted, the phone should not vibrate but instead I display some red bar in the UI telling the user why the scanned barcode will not be accepted.

I would also very much appreciate if the length of vibration would be configurable.

And mind the typo in VibationOnDetected plz ;-)

Dark camera preview

Testing the sample app with my Moto G (4) with Android 6.0.1 the camera preview is noticeably darker than the stock camera app. I believe this is because the FPS is too high for the dynamic exposure to work. There is probably a more sophisticated solution, but I found that setting the FPS with CameraSource.Builder.SetRequestedFps() fixed the issue. The maximum value to 1 dp that worked for me was 17.5f. Perhaps a configuration parameter could be added for FPS to allow this to be fixed while also allowing a higher FPS if that is preferred?

SetSupportBarcodeFormat allows to set just one format or all

Current implementation of SetSupportBarcodeFormat allows to set just one format or all. It is not possible to set multiple formats.
Like: Methods.SetSupportBarcodeFormat(BarcodeFormats.Pdf417 | BarcodeFormats.QRCode);

This is because current implementation of ConvertBarcodeFormats uses switch:
https://github.com/JimmyPun610/BarcodeScanner.XF/blob/6de6a5535a5c541d7c5dbe5e15575c36ad2209bc/GoogleVisionBarCodeScanner.Droid/Methods.cs#L62
It should be implemented like this:

public static Android.Gms.Vision.Barcodes.BarcodeFormat ConvertBarcodeFormats(BarcodeFormats barcodeFormats)
        {
            Android.Gms.Vision.Barcodes.BarcodeFormat format = Android.Gms.Vision.Barcodes.BarcodeFormat.AllFormats;

            if((barcodeFormats & BarcodeFormats.CodaBar) == BarcodeFormats.CodaBar)
            {
                format |= Android.Gms.Vision.Barcodes.BarcodeFormat.Codabar;
            }
            if ((barcodeFormats & BarcodeFormats.Code128) == BarcodeFormats.Code128)
            {
                format |= Android.Gms.Vision.Barcodes.BarcodeFormat.Code128;
            }

            .....
            .....
            .....
            .....

            return format;
        }

Adding this nuget makes Xamarin.iOS project fail to build

Description
After upgrading to latest nuget (version 4.5.0.1) the Xamarin.iOS project fails to build in Debug and Release mode with this message:

MTOUCH : error MT2101: Can't resolve the reference 'System.Collections.Generic.IDictionary2<System.Int32,System.Collections.Generic.List1<Xamarin.Forms.ITabStopElement>> Xamarin.Forms.TabIndexExtensions::GetTabIndexesOnParentPage(Xamarin.Forms.ITabStopElement,System.Int32&,System.Boolean)', referenced from the method 'UIKit.UIView Xamarin.Forms.Platform.iOS.VisualElementRenderer`1::FocusSearch(System.Boolean)' in 'Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'.

I narrowed it down to this package. If I set Linker mode to "Don't Link" it builds successfully. This isn't a problem in Android. The Xamarin.Firebase.iOS.MLKit version 0.13.0.2 drags in the Xamarin.Forms.Core requirement and the other packages in my application require later versions of Xamarin.Forms.Core causing the issue.

Steps to Reproduce

  1. git clone BarcodeScanner.XF
  2. Modify build to linker behavior selection to "Link All"
  3. Build SamleApp.iOS
  4. The MT2101 error from above occurs.

Basic Information
Visual Studio for Mac: 8.5.4
Xamarin.Forms: 4.5.0.617
BarcodeScanner.XF: 4.5.0.1

iOS Firebase dependencies cause App Store rejection

Older versions of Xamarin.Firebase.iOS.Auth contain references to the deprecated UIWebView API. Apple no longer accepts App Store publications with the following message:

"ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability. Learn more (https://developer.apple.com/documentation/uikit/uiwebview). "

Newer versions of the package supposedly fixed the issue, according to this issue. Can you please update the dependencies in your package?

Xamarin Forms compiling Issues in Visual Studio 2019 - Xamarin Forms iOS

Following your instructions to include the NuGet, if you use the visual studio for windows. it doesn't build for the iOS project, however, it compiles through the visual studio for mac.

Microsoft Visual Studio Enterprise 2019 Version 16.9.4
VisualStudio.Mac 1.0
Xamarin 16.9.000.273 (d16-9@1bba9e0)
Xamarin.Android SDK 11.2.2.1 (d16-9/877f572)
Xamarin.iOS and Xamarin.Mac SDK 14.14.2.5 (3836759d4)

Error
'/Users/sensio/Library/Caches/Xamarin/mtbs/builds/dre.iOS/0c29abbdfbe8303ee579ef50f6080ef7b8a6c1ad5e75432d99b6a024ccea7e7e/bin/iPhone/Debug/device-builds/iphone12.8-14.4.2/dre.iOS.exe' dre.iOS C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets 425

Sample App Crashing On IOS 14.4

On Android plugin works flawless, but on IOS i cant make it work it's always crashing.

Device : Iphone 7+
IOS : 14.4

I dont know the internals but default 'app' value is null, therefore its crashing
image

[0:] An error occurred: 'Value cannot be null.
Parameter name: app'. Callstack: '  at Firebase.MLKit.Vision.VisionApi.Create (Firebase.Core.App app) <0x10aadb6b0 + 0x00014> in <8607cf18847b4467a58b3fd7d84f75f1>:0 
  at Firebase.MLKit.Vision.VisionApi.Create () <0x10aadae88 + 0x00006> in <8607cf18847b4467a58b3fd7d84f75f1>:0 
  at GoogleVisionBarCodeScanner.UICameraPreview+CaptureVideoDelegate..ctor (System.Boolean vibrationOnDetected) [0x0004c] in C:\Users\Kursat\source\repos\BarcodeScanner.XF\GoogleVisionBarCodeScanner\iOS\UICameraPreview.cs:177 
  at GoogleVisionBarCodeScanner.UICameraPreview.Initialize (System.Boolean defaultTorchOn, System.Boolean vibrationOnDetected, System.Boolean startScanningOnCreate) [0x0011a] in C:\Users\Kursat\source\repos\BarcodeScanner.XF\GoogleVisionBarCodeScanner\iOS\UICameraPreview.cs:140 
  at GoogleVisionBarCodeScanner.UICameraPreview..ctor (System.Boolean defaultTorchOn, System.Boolean vibrationOnDetected, System.Boolean startScanningOnCreate) [0x00008] in C:\Users\Kursat\source\repos\BarcodeScanner.XF\GoogleVisionBarCodeScanner\iOS\UICameraPreview.cs:39 
  at GoogleVisionBarCodeScanner.Renderer.CameraViewRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1[TElement] e) [0x00059] in C:\Users\Kursat\source\repos\BarcodeScanner.XF\GoogleVisionBarCodeScanner\iOS\Renderer\CameraViewRenderer.cs:25 
  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:115 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:49 
  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:115 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:49 
  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:3265 
  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.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:65 
  at SampleApp.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\Kursat\source\repos\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 '
The app has been terminated.

CameraView has fix size.

This causes the following issues

  • CameraView has larger than screen size in landscape.

  • CameraView has limited layout options in all orientations.

I think the issue is caused from CameraViewRenderer.CameraView_SizeChanged where HeightRequest is set to view width.

Scanner is not working on some devices

I made an application using the library. The scanner works fine on a couple of devices, but doesn't work at all one some other. For example it doesn't work on Cat S31 or on Nokia 7.1 with Android Oreo v. 8.1.

Generate Qr Barcodes

I know this library is for scanning barcodes. But does the technology underneath allow to also generate QR barcode images from a given text?

I am really struggling with Zxing.NET and ZXing.Net.Mobile.Forms to have something simple like generating a Stream or an image byte[] that I can use as an image Source, and I was wondering whether the google technology BarcodeScanner.XF uses, is capable of something similar.

Thanks

iOS scan interval

@JimmyPun610 is there a reason for the 1 second scan interval on iOS? In order to discard "false positives" we capture & count the scanned barcodes and then we keep the ones with the most hits. On Android this work great because it scans many times per second. But on iOS this strategy is really slow, we have to wait several seconds to have a decent barcode count.

Btw, this library is being very helpful, thank you.

Double scan on iOS

Hi, great job.

CameraView_OnDetected is fired two times (sometimes even more than two) on iOS (android works fine).

You can reproduce it in the Sample App.

If I may, I'll suggest to fire CameraView_OnDetected in the Main Thread.

Thank you,
Dottor Pagliaccius

iOS crash Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException

Hi,

I am using this plugin v5.0.2 with Xamarin.Forms 5.0.0.2012 and I am having a crash on iOS.
Everything works fine in Android.

The crash happens just before opening the view that contains the gvcamera. The flash light gets on but the app crashes soon after and the view is not displayed.

This is what I get in the output

2021-03-18 21:42:26.590 app.iOS[395:31157] -[UIWindow windowScene]: unrecognized selector sent to instance 0x10df7bea0
2021-03-18 21:42:46.877 app.iOS[395:31196] XPC connection interrupted
2021-03-18 21:42:53.895 app.iOS[395:31157] [AppCenterCrashes] ERROR: +[MSACWrapperLogger MSACWrapperLog:tag:level:]/10 Unhandled Exception:
Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[UIWindow windowScene]: unrecognized selector sent to instance 0x10df7bea0
Native stack trace:
	0   CoreFoundation                      0x000000018f206f10 <redacted> + 252
	1   libobjc.A.dylib                     0x000000018e3d4a40 objc_exception_throw + 56
	2   CoreFoundation                      0x000000018f11e154 <redacted> + 0
	3   UIKitCore                           0x00000001bbc525c0 <redacted> + 280
	4   CoreFoundation                      0x000000018f20c810 <redacted> + 1412
	5   CoreFoundation                      0x000000018f20e4bc _CF_forwarding_prep_0 + 92
	6   app.iOS                          0x000000010827b9c0 FBMLNLx_SRLRegistrySharedInstanceForProviders + 39855572
	7   app.iOS                          0x00000001081fd9a8 FBMLNLx_SRLRegistrySharedInstanceForProviders + 39339452
	8   app.iOS                          0x0000000109fb09ac FBMLNLx_SRLRegistrySharedInstanceForProviders + 70481344
	9   app.iOS                          0x0000000109fb0560 FBMLNLx_SRLRegistrySharedInstanceForProviders + 70480244
	10  app.iOS                          0x000000010721fc90 FBMLNLx_SRLRegistrySharedInstanceForProviders + 22702244
	11  app.iOS                          0x000000010adb613c mono_pmip + 28192
	12  app.iOS                          0x000000010ae723f8 mono_pmip + 798940
	13  app.iOS                          0x000000010ae75c5c mono_pmip + 813376
	14  app.iOS                          0x0000000106e19f8c FBMLNLx_SRLRegistrySharedInstanceForProviders + 18484128
	15  app.iOS                          0x0000000106e48bd4 FBMLNLx_SRLRegistrySharedInstanceForProviders + 18675688
	16  UIKitCore                           0x00000001bc0c7f44 <redacted> + 1380
	17  QuartzCore                          0x00000001937e8a34 <redacted> + 184
	18  QuartzCore                          0x00000001937ed9c4 <redacted> + 324
	19  QuartzCore                          0x000000019374c9d4 <redacted> + 340
	20  QuartzCore                          0x000000019377b2f4 <redacted> + 608
	21  UIKitCore                           0x00000001bbc1e400 <redacted> + 172
	22  UIKitCore                           0x00000001bbd0dfb0 <redacted> + 5516
	23  UIKitCore                           0x00000001bbd0683c <redacted> + 152
	24  CoreFoundation                      0x000000018f1955b8 <redacted> + 24
	25  CoreFoundation                      0x000000018f195538 <redacted> + 88
	26  CoreFoundation                      0x000000018f194e1c <redacted> + 176
	27  CoreFoundation                      0x000000018f18fce8 <redacted> + 1040
	28  CoreFoundation                      0x000000018f18f5b8 CFRunLoopRunSpecific + 436
	29  GraphicsServices                    0x0000000191403584 GSEventRunModal + 100
	30  UIKitCore                           0x00000001bbc24bc8 UIApplicationMain + 212
	31  app.iOS                          0x0000000108298a78 FBMLNLx_SRLRegistrySharedInstanceForProviders + 39974540
	32  app.iOS                          0x00000001081d1dc0 FBMLNLx_SRLRegistrySharedInstanceForProviders + 39160276
	33  app.iOS                          0x00000001081d1d44 FBMLNLx_SRLRegistrySharedInstanceForProviders + 39160152
	34  app.iOS                          0x0000000106e4ef30 FBMLNLx_SRLRegistrySharedInstanceForProviders + 18701124
	35  app.iOS                          0x000000010721fc90 FBMLNLx_SRLRegistrySharedInstanceForProviders + 22702244
	36  app.iOS                          0x000000010adb613c mono_pmip + 28192
	37  app.iOS                          0x000000010ae723f8 mono_pmip + 798940
	38  app.iOS                          0x000000010ae78650 mono_pmip + 824116
	39  app.iOS                          0x000000010ad946d0 FBMLNLx_SRLRegistrySharedInstanceForProviders + 85045988
	40  app.iOS                          0x000000010af7d8d8 xamarin_GetFolderPath + 20100
	41  app.iOS                          0x0000000106e4ee38 FBMLNLx_SRLRegistrySharedInstanceForProviders + 18700876
	42  libdyld.dylib                       0x000000018ec4fb94 <redacted> + 4

  at ObjCRuntime.Runtime.ThrowNSException (System.IntPtr ns_exception) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:407 
  at ObjCRuntime.Runtime.throw_ns_exception (System.IntPtr exc) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/runtime/Delegates.generated.cs:126 
  at (wrapper native-to-managed) ObjCRuntime.Runtime.throw_ns_exception(intptr)
  at (wrapper managed-to-native) ObjCRuntime.Messaging.IntPtr_objc_msgSend(intptr,intptr)
  at UIKit.UIWindow.get_WindowScene () [0x0000d] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/ios/native/UIKit/UIWindow.g.cs:476 
  at GoogleVisionBarCodeScanner.UICameraPreview.setPreviewOrientation () [0x0003a] in <07a2a8628e5f48b4a932d4ede11d52d7>:0 
  at GoogleVisionBarCodeScanner.UICameraPreview.LayoutSubviews () [0x00008] in <07a2a8628e5f48b4a932d4ede11d52d7>:0 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:65 
  at app.iOS.Application.Main (System.String[] args) [0x00001] in /Users/.../app.iOS/Main.cs:17 
--- End of stack trace from previous location where exception was thrown ---

  at (wrapper managed-to-native) ObjCRuntime.Messaging.IntPtr_objc_msgSend(intptr,intptr)
  at UIKit.UIWindow.get_WindowScene () [0x0000d] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/ios/native/UIKit/UIWindow.g.cs:476 
  at GoogleVisionBarCodeScanner.UICameraPreview.setPreviewOrientation () [0x0003a] in <07a2a8628e5f48b4a932d4ede11d52d7>:0 
  at GoogleVisionBarCodeScanner.UICameraPreview.LayoutSubviews () [0x00008] in <07a2a8628e5f48b4a932d4ede11d52d7>:0 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:65 
  at app.iOS.Application.Main (System.String[] args) [0x00001] in /Users/.../app.iOS/Main.cs:17 	0   CoreFoundation                      0x000000018f206f10 <redacted> + 252
	1   libobjc.A.dylib                     0x000000018e3d4a40 objc_exception_throw + 56
	2   CoreFoundation                      0x000000018f11e154 <redacted> + 0
	3   UIKitCore                           0x00000001bbc525c0 <redacted> + 280
	4   CoreFoundation                      0x000000018f20c810 <redacted> + 1412
	5   CoreFoundation                      0x000000018f20e4bc _CF_forwarding_prep_0 + 92
	6   app.iOS                          0x000000010827b9c0 FBMLNLx_SRLRegistrySharedInstanceForProviders + 39855572
	7   app.iOS                          0x00000001081fd9a8 FBMLNLx_SRLRegistrySharedInstanceForProviders + 39339452
	8   app.iOS                          0x0000000109fb09ac FBMLNLx_SRLRegistrySharedInstanceForProviders + 70481344
	9   app.iOS                          0x0000000109fb0560 FBMLNLx_SRLRegistrySharedInstanceForProviders + 70480244
	10  app.iOS                          0x000000010721fc90 FBMLNLx_SRLRegistrySharedInstanceForProviders + 22702244
	11  app.iOS                          0x000000010adb613c mono_pmip + 28192
	12  app.iOS                          0x000000010ae723f8 mono_pmip + 798940
	13  app.iOS                          0x000000010ae75c5c mono_pmip + 813376
	14  app.iOS                          0x0000000106e19f8c FBMLNLx_SRLRegistrySharedInstanceForProviders + 18484128
	15  app.iOS                          0x0000000106e48bd4 FBMLNLx_SRLRegistrySharedInstanceForProviders + 18675688
	16  UIKitCore                           0x00000001bc0c7f44 <redacted> + 1380
	17  QuartzCore                          0x00000001937e8a34 <redacted> + 184
	18  QuartzCore                          0x00000001937ed9c4 <redacted> + 324
	19  QuartzCore                          0x000000019374c9d4 <redacted> + 340
	20  QuartzCore                          0x000000019377b2f4 <redacted> + 608
	21  UIKitCore                           0x00000001bbc1e400 <redacted> + 172
	22  UIKitCore                           0x00000001bbd0dfb0 <redacted> + 5516
	23  UIKitCore                           0x00000001bbd0683c <redacted> + 152
	24  CoreFoundation                      0x000000018f1955b8 <redacted> + 24
	25  CoreFoundation                      0x000000018f195538 <redacted> + 88
	26  CoreFoundation                      0x000000018f194e1c <redacted> + 176
	27  CoreFoundation                      0x000000018f18fce8 <redacted> + 1040
	28  CoreFoundation                      0x000000018f18f5b8 CFRunLoopRunSpecific + 436
	29  GraphicsServices                    0x0000000191403584 GSEventRunModal + 100
	30  UIKitCore                           0x00000001bbc24bc8 UIApplicationMain + 212
	31  app.iOS                          0x0000000108298a78 FBMLNLx_SRLRegistrySharedInstanceForProviders + 39974540
	32  app.iOS                          0x00000001081d1dc0 FBMLNLx_SRLRegistrySharedInstanceForProviders + 39160276
	33  app.iOS                          0x00000001081d1d44 FBMLNLx_SRLRegistrySharedInstanceForProviders + 39160152
	34  app.iOS                          0x0000000106e4ef30 FBMLNLx_SRLRegistrySharedInstanceForProviders + 18701124
	35  app.iOS                          0x000000010721fc90 FBMLNLx_SRLRegistrySharedInstanceForProviders + 22702244
	36  app.iOS                          0x000000010adb613c mono_pmip + 28192
	37  app.iOS                          0x000000010ae723f8 mono_pmip + 798940
	38  app.iOS                          0x000000010ae78650 mono_pmip + 824116
	39  app.iOS                          0x000000010ad946d0 FBMLNLx_SRLRegistrySharedInstanceForProviders + 85045988
	40  app.iOS                          0x000000010af7d8d8 xamarin_GetFolderPath + 20100
	41  app.iOS                          0x0000000106e4ee38 FBMLNLx_SRLRegistrySharedInstanceForProviders + 18700876
	42  libdyld.dylib                       0x000000018ec4fb94 <redacted> + 4
2021-03-18 21:42:53.941 app.iOS[395:31157] Unhandled managed exception: Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[UIWindow windowScene]: unrecognized selector sent to instance 0x10df7bea0
Native stack trace:
	0   CoreFoundation                      0x000000018f206f10 <redacted> + 252
	1   libobjc.A.dylib                     0x000000018e3d4a40 objc_exception_throw + 56
	2   CoreFoundation                      0x000000018f11e154 <redacted> + 0
	3   UIKitCore                           0x00000001bbc525c0 <redacted> + 280
	4   CoreFoundation                      0x000000018f20c810 <redacted> + 1412
	5   CoreFoundation                      0x000000018f20e4bc _CF_forwarding_prep_0 + 92
	6   app.iOS                          0x000000010827b9c0 FBMLNLx_SRLRegistrySharedInstanceForProviders + 39855572
	7   app.iOS                          0x00000001081fd9a8 FBMLNLx_SRLRegistrySharedInstanceForProviders + 39339452
	8   app.iOS                          0x0000000109fb09ac FBMLNLx_SRLRegistrySharedInstanceForProviders + 70481344
	9   app.iOS                          0x0000000109fb0560 FBMLNLx_SRLRegistrySharedInstanceForProviders + 70480244
	10  app.iOS                          0x000000010721fc90 FBMLNLx_SRLRegistrySharedInstanceForProviders + 22702244
	11  app.iOS                          0x000000010adb613c mono_pmip + 28192
	12  app.iOS                          0x000000010ae723f8 mono_pmip + 798940
	13  app.iOS                          0x000000010ae75c5c mono_pmip + 813376
	14  app.iOS                          0x0000000106e19f8c FBMLNLx_SRLRegistrySharedInstanceForProviders + 18484128
	15  app.iOS                          0x0000000106e48bd4 FBMLNLx_SRLRegistrySharedInstanceForProviders + 18675688
	16  UIKitCore                           0x00000001bc0c7f44 <redacted> + 1380
	17  QuartzCore                          0x00000001937e8a34 <redacted> + 184
	18  QuartzCore                          0x00000001937ed9c4 <redacted> + 324
	19  QuartzCore                          0x000000019374c9d4 <redacted> + 340
	20  QuartzCore                          0x000000019377b2f4 <redacted> + 608
	21  UIKitCore                           0x00000001bbc1e400 <redacted> + 172
	22  UIKitCore                           0x00000001bbd0dfb0 <redacted> + 5516
	23  UIKitCore                           0x00000001bbd0683c <redacted> + 152
	24  CoreFoundation                      0x000000018f1955b8 <redacted> + 24
	25  CoreFoundation                      0x000000018f195538 <redacted> + 88
	26  CoreFoundation                      0x000000018f194e1c <redacted> + 176
	27  CoreFoundation                      0x000000018f18fce8 <redacted> + 1040
	28  CoreFoundation                      0x000000018f18f5b8 CFRunLoopRunSpecific + 436
	29  GraphicsServices                    0x0000000191403584 GSEventRunModal + 100
	30  UIKitCore                           0x00000001bbc24bc8 UIApplicationMain + 212
	31  app.iOS                          0x0000000108298a78 FBMLNLx_SRLRegistrySharedInstanceForProviders + 39974540
	32  app.iOS                          0x00000001081d1dc0 FBMLNLx_SRLRegistrySharedInstanceForProviders + 39160276
	33  app.iOS                          0x00000001081d1d44 FBMLNLx_SRLRegistrySharedInstanceForProviders + 39160152
	34  app.iOS                          0x0000000106e4ef30 FBMLNLx_SRLRegistrySharedInstanceForProviders + 18701124
	35  app.iOS                          0x000000010721fc90 FBMLNLx_SRLRegistrySharedInstanceForProviders + 22702244
	36  app.iOS                          0x000000010adb613c mono_pmip + 28192
	37  app.iOS                          0x000000010ae723f8 mono_pmip + 798940
	38  app.iOS                          0x000000010ae78650 mono_pmip + 824116
	39  app.iOS                          0x000000010ad946d0 FBMLNLx_SRLRegistrySharedInstanceForProviders + 85045988
	40  app.iOS                          0x000000010af7d8d8 xamarin_GetFolderPath + 20100
	41  app.iOS                          0x0000000106e4ee38 FBMLNLx_SRLRegistrySharedInstanceForProviders + 18700876
	42  libdyld.dylib                       0x000000018ec4fb94 <redacted> + 4
 (Foundation.MonoTouchException)
  at ObjCRuntime.Runtime.ThrowNSException (System.IntPtr ns_exception) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:407 
  at ObjCRuntime.Runtime.throw_ns_exception (System.IntPtr exc) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/runtime/Delegates.generated.cs:126 
  at (wrapper native-to-managed) ObjCRuntime.Runtime.throw_ns_exception(intptr)
  at (wrapper managed-to-native) ObjCRuntime.Messaging.IntPtr_objc_msgSend(intptr,intptr)
  at UIKit.UIWindow.get_WindowScene () [0x0000d] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/ios/native/UIKit/UIWindow.g.cs:476 
  at GoogleVisionBarCodeScanner.UICameraPreview.setPreviewOrientation () [0x0003a] in <07a2a8628e5f48b4a932d4ede11d52d7>:0 
  at GoogleVisionBarCodeScanner.UICameraPreview.LayoutSubviews () [0x00008] in <07a2a8628e5f48b4a932d4ede11d52d7>:0 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:65 
  at  app.iOS.Application.Main (System.String[] args) [0x00001] in /Users/.../app.iOS/Main.cs:17 
--- End of stack trace from previous location where exception was thrown ---

  at (wrapper managed-to-native) ObjCRuntime.Messaging.IntPtr_objc_msgSend(intptr,intptr)
  at UIKit.UIWindow.get_WindowScene () [0x0000d] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/ios/native/UIKit/UIWindow.g.cs:476 
  at GoogleVisionBarCodeScanner.UICameraPreview.setPreviewOrientation () [0x0003a] in <07a2a8628e5f48b4a932d4ede11d52d7>:0 
  at GoogleVisionBarCodeScanner.UICameraPreview.LayoutSubviews () [0x00008] in <07a2a8628e5f48b4a932d4ede11d52d7>:0 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:65 
  at app.iOS.Application.Main (System.String[] args) [0x00001] in /Users/.../app.iOS/Main.cs:17 


Thank you for your help!

License?

Hello, could you please add a license file to clarify how this code can be used?

I am hopeful that you will choose an Apache or MIT style license :).

Thanks!

Android v10(q10)

07-15 12:36:16.228 I/DynamiteModule(24171): Considering local module com.google.android.gms.vision.barcode:0 and remote module com.google.android.gms.vision.barcode:0
07-15 12:36:16.229 E/Vision (24171): Error loading module com.google.android.gms.vision.barcode optional module true: com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module found. Local version is 0 and remote version is 0.
07-15 12:36:16.229 W/DynamiteModule(24171): Local module descriptor class for com.google.android.gms.vision.dynamite.barcode not found.
07-15 12:36:16.238 D/ViewRootImpl@71a4cd2MainActivity: ViewPostIme pointer 1
07-15 12:36:16.246 I/DynamiteModule(24171): Considering local module com.google.android.gms.vision.dynamite.barcode:0 and remote module com.google.android.gms.vision.dynamite.barcode:0
07-15 12:36:16.247 D/BarcodeNativeHandle(24171): Cannot load feature, fall back to load dynamite module.
07-15 12:36:16.261 W/DynamiteModule(24171): Local module descriptor class for com.google.android.gms.vision.barcode not found.
07-15 12:36:16.261 I/DynamiteModule(24171): Considering local module com.google.android.gms.vision.barcode:0 and remote module com.google.android.gms.vision.barcode:0
07-15 12:36:16.262 E/Vision (24171): Error loading module com.google.android.gms.vision.barcode optional module true: com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module found. Local version is 0 and remote version is 0.

Delay scanning best practice

Great library by the way!

I was wondering what's the recommended approach when scanning continuously with Methods.SetIsScanning(true); to allow certain delay between scans.

Would you sleep the thread or is there a better alternative with Xamarin forms?

System.NotSupportedException

Hi there.

I am having some trouble running the example project. When I open any camera view, I get the error below:

System.NotSupportedException: 'Unable to activate instance of type Android.Util.SparseArray

I am on VS2019 community and Android 10.

I have a feeling I know what the solution is. I have found this issue from 3 days ago on the VS developer community. It talks about a camera view which I would think is similar to how the cameraview in this project works. Someone made a comment there saying it was solved when moving to VS2019 preview, specifically VS16.7 preview 1. I will try this and update the issue accordingly.

Just wanted to make this issue so you and others are aware of this, I don't think it is something that can be solved by you but is something with VS. Again, I'll update if using the preview version solves my problem.

Aztec barcodes

Hi,

Is there any particular reason why Aztec barcodes are not supported right know? Otherwise I will make a pull request to add it.

iOS: Unhandled Managed Exception thrown on app start when camera permission denied

After denying permissions on iOS, every time the app is started, it crashes with the following exception.

Unhandled managed exception: Could not initialize an instance of the type 'AVFoundation.AVCaptureDeviceInput': the native 'initWithDevice:error:' method returned nil.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false. (System.Exception)
  at Foundation.NSObject.InitializeHandle (System.IntPtr handle, System.String initSelector) [0x000a8] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/Foundation/NSObject2.cs:504 
  at AVFoundation.AVCaptureDeviceInput..ctor (AVFoundation.AVCaptureDevice device, Foundation.NSError& error) [0x00027] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/AVCaptureDeviceInput.g.cs:80 
  at GoogleVisionBarCodeScanner.UICameraPreview.Initialize (System.Boolean defaultTorchOn, System.Boolean vibrationOnDetected, System.Boolean startScanningOnCreate) [0x0009d] in <d513dc25a3de4543b7e74dac86eab609>:0 
  at GoogleVisionBarCodeScanner.UICameraPreview..ctor (System.Boolean d<โ€ฆ>

iOS version: 13.7
Xamarin.Forms version: 4.8.0.1451

VisionApi.Create not get correct App

Hi!

When start demo example, i have error, there is a workaround?:

Parameter name: app'. Callstack: ' at Firebase.MLKit.Vision.VisionApi.Create (Firebase.Core.App app) <0x1502279c8 + 0x00014> in <8607cf18847b4467a58b3fd7d84f75f1>:0
at GoogleVisionBarCodeScanner.UICameraPreview+CaptureVideoDelegate..ctor (System.Boolean vibrationOnDetected) [0x0004c] in D:\BarcodeScanner.XF-master\GoogleVisionBarCodeScanner\iOS\UICameraPreview.cs:178
at GoogleVisionBarCodeScanner.UICameraPreview.Initialize (System.Boolean defaultTorchOn, System.Boolean vibrationOnDetected, System.Boolean startScanningOnCreate) [0x0011a] in D:\BarcodeScanner.XF-master\GoogleVisionBarCodeScanner\iOS\UICameraPreview.cs:141
at GoogleVisionBarCodeScanner.UICameraPreview..ctor (System.Boolean defaultTorchOn, System.Boolean vibrationOnDetected, System.Boolean startScanningOnCreate) [0x00008] in D:\BarcodeScanner.XF-master\GoogleVisionBarCodeScanner\iOS\UICameraPreview.cs:39
at GoogleVisionBarCodeScanner.Renderer.CameraViewRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs1[TElement] e) [0x00059] in D:\BarcodeScanner.XF-master\GoogleVisionBarCodeScanner\iOS\Renderer\CameraViewRenderer.cs:25 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x00172] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:296

Adding this NuGet will make iOS project fail to build

Thanks for your great and helpful library.

Description

After upgrading to latest Visual Studio version (16.5.4) the iOS project fails to build in Release/Ad-Hoc mode with this message:
error MT2002: Failed to resolve "Xamarin.Forms.Platform.iOS.IndicatorViewRenderer" reference from "Xamarin.Forms.Platform.iOS, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null

After some investigations I narrowed down the problem to your package. I found out that after adding it, some types are no longer resolvable (such as IndicatorViewRenderer). The iOS project works fine in debug mode but not in release mode. If I set Linker mode to "Don't Link" the project would build successfully.
Android has not any problem.
Here's a similar discussion:
https://forums.xamarin.com/discussion/180561/xamarin-forms-platform-ios-indicatorviewrenderer-fails-to-resolve

Steps to Reproduce

  1. Create a blank Xamarin.Forms project
  2. Update default NuGet packages to latest versions (Xamarin.Forms --> 4.5.0.617, Xamarin.Essentials --> 1.5.2)
  3. Observe that the type Xamarin.Forms.Platform.iOS.IndicatorViewRenderer is accessible.
  4. Add BarcodeScanner.XF package to projects
  5. Rebuild solution.
  6. The type Xamarin.Forms.Platform.iOS.IndicatorViewRenderer is no longer accessible.

Basic Information

Visual Studio: 16.5.4
Xamarin.Forms: 4.5.0.617
BarcodeScanner.XF: 4.2.2.3

Code doesn't compile

Missing Page2 and Page3. It also says that it's missing GoogleService-Info.plist.

Native Crash reporting -

Installed NugetPackage 4.8.0 , and followed sample but once camera preview is presented UI becomes unresponsive and native code crashes ,...please find following log and setup details for better understanding of my issue.

=== Visual Studio Community 2019 for Mac ===

Version 8.8.6 (build 15)
Installation UUID: 2f0f3b11-4534-4e09-ab48-8a6b53f97817
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

Package version: 612000113

=== Mono Framework MDK ===

Runtime:
Mono 6.12.0.113 (2020-02/4fdfb5b1fd5) (64-bit)
Package version: 612000113

=== Roslyn (Language Service) ===

3.8.0-5.20519.18+4c195c3ac1974edcefa76774d7a59a2350ec55fa

=== NuGet ===

Version: 5.8.0.6860

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/5.0.102/Sdks
SDK Versions:
5.0.102
5.0.101
5.0.100
3.1.405
3.1.404
3.1.301
3.1.200
3.0.100
2.1.701
MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
5.0.2
5.0.1
5.0.0
3.1.11
3.1.10
3.1.5
3.1.2
3.0.0
2.1.19
2.1.16
2.1.13
2.1.12

=== .NET Core 3.1 SDK ===

SDK: 3.1.405

=== Xamarin.Profiler ===

Version: 1.6.15.68
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 12.4 (17801)
Build 12D4e

=== Xamarin.Mac ===

Version: 7.2.0.3 (Visual Studio Community)
Hash: c51fabee8
Branch: xcode12.3
Build date: 2020-12-10 21:05:04-0500

=== Xamarin.iOS ===

Version: 14.8.0.3 (Visual Studio Community)
Hash: c51fabee8
Branch: xcode12.3
Build date: 2020-12-10 21:05:05-0500

=== Xamarin Designer ===

Version: 16.8.0.510
Hash: 44e3f3ce9
Branch: remotes/origin/d16-8
Build date: 2020-12-10 00:06:14 UTC

=== Xamarin.Android ===

Version: 11.1.0.26 (Visual Studio Community)
Commit: xamarin-android/d16-8/a36ce73
Android SDK: /Users/vahidahavaldar/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
6.0 (API level 23)
8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 30.0.5
SDK Build Tools Version: 29.0.2

Build Information:
Mono: 5e9cb6d
Java.Interop: xamarin/java.interop@79d9533
ProGuard: Guardsquare/proguard@ebe9000
SQLite: xamarin/sqlite@1a3276b
Xamarin.Android Tools: xamarin/xamarin-android-tools@2fb1cbc

=== Microsoft OpenJDK for Mobile ===

Java SDK: /Users/vahidahavaldar/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.8.0.32
Hash: 01a7774
Branch: remotes/origin/d16-8
Build date: 2021-01-14 00:34:58 UTC

=== Android Device Manager ===

Version: 16.8.0.46
Hash: 0a81419
Branch: remotes/origin/d16-8
Build date: 2021-01-14 00:35:22 UTC

=== Build Information ===

Release ID: 808060015
Git revision: d34d29b4643a130479d762e4d2b5750e6462fde7
Build date: 2021-01-15 08:35:04-05
Build branch: release-8.8
Xamarin extensions: d34d29b4643a130479d762e4d2b5750e6462fde7

=== Operating System ===

Mac OS X 10.15.5
Darwin 19.5.0 Darwin Kernel Version 19.5.0
Tue May 26 20:41:44 PDT 2020
root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.