Redth / ZXing.Net.Mobile

Barcode Scanner for Xamarin.iOS, Xamarin.Android, UWP and Tizen
MIT License
1.07k stars 703 forks source link

Unable to scan on iOS and extremely finicky scanning on Android #483

Closed julesx closed 4 years ago

julesx commented 7 years ago

I am trying to use the Forms component in my app. On iOS, the barcode is never scanned. Everything looks like its working, but the code is just never captured, and OnScanResult is never called.

On android, there seems to be some auto focus issues which you can semi work around, but the scanning is still SUPER finicky. It takes a long time to capture the barcode, and it should be instant.

I can't imagine I am the only one having this problem. Is anyone successfully reading barcodes on both platforms?? It doesn't look like this package is being very actively maintained given the number of open issues and bugs...is there another option?

Why does my ZXingScannerPage throw binding errors against all the scanner page properties? Is it intended by default that we create a backing view model for the page? This isn't anywhere in the docs. Why is IsScanning and IsAnalyzing constantly false? This is confusing.

Reading the issues here, there are a TON of open issues all related to new iOS permissions, and a lot of auto focus issues. Could someone maybe clean up the duplicate issues?

The samples do not run in VS2015. I pull it down from github, and just see errors everywhere, restore packages, still a ton of errors everywhere, the samples are not even using the latest version of XF, projects do not build.

Examining the references in the sample projects vs. installing the nuget into my project, i notice a key difference: my android and iOS projects include a ref to ZxingNetMobile, which the sample projects do not. Removing these references from my project causes resource errors on android.

faceoffers28 commented 7 years ago

It all works for me, but I'm not running the latest versions of Xamarin.Forms, Xamarin.iOS, Xamarin.Android ,ZXing.Net.Mobile or ZXing.Net.Mobile.Forms. I find that when I do upgrades, that's when I run into problems, so I use what I know works and carefully and gradually make upgrades over time. You have to find the combination that works for you. Since you are using Visual Studio 2015, you will also have to make sure that Xamarin.iOS on your Mac matches as close as possible the version you are running in VS. Here is what works for me.

Visual Studio Ultimate Update 5 Xamarin 4.0.4.4 (a9c7826) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android. Xamarin.Android 6.0.4.0 (ee215fc) Visual Studio plugin to enable development for Xamarin.Android. Xamarin.iOS 9.6.2.2 (be25da5) Visual Studio extension to enable development for Xamarin.iOS.

Mac Take a look at the release dates of the Mac SDKs and mirror the above as much as possible.

Nuget packages i'm running. Installed in both the Xamarin.Forms, iOS and Android apps Install-Package Xamarin.Forms -Version 2.2.0.31 Install-Package ZXing.Net.Mobile -Version 2.1.44 Install-Package ZXing.Net.Mobile.Forms -Version 2.1.44

*Android is compiled against API 23.

I believe that people run into issues when trying to run the latest and greatest version of the Xamarin SDKs. You have to experiment and find what works for you. Hope this helps.

julesx commented 7 years ago

Hi. Thanks for the response. I've managed to get it up and running on both platforms, but the time it takes to capture the barcode is ridiculously long. Any other scanner app I download can identify a barcode in milliseconds, while this package is extremely finicky with focus and takes ridiculously long to capture anything.

faceoffers28 commented 7 years ago

Glad to hear you got it running. What do you mean by "ridiculously long"? It takes a few seconds for me on iPhone, Android and UWP Windows 10 Mobile. I haven't been able to get it to work on UWP Windows 10 Desktop due to an Auto Focus issue, which might have been fixed in a newer package. The reason I ask that I'm not sure what is standard and what customers expect in terms of barcode scanning. Are you reading barcodes from a screen or are you scanning them from paper? I know some people have reported issues with stretched or improperly resized barcodes.

julesx commented 7 years ago

I am scanning a huge barcode on a piece of paper. Basically you have to hold the phone perfectly still while constantly tapping the screen to even hope to have a chance of capturing the barcode. It is not an acceptable user experience. Random scanning apps downloaded from the store are able to INSTANTLY pick up the same code on the same paper. I am testing with an iPhone 7 and a Samsung Grand Prime.

Redth commented 4 years ago

Thanks for reporting this issue! Unforunately it took me way too long to respond 😭. Sorry, I apologize! Recently the source code for this project was completely refactored to modernize it. Many PR's were included in this effort, and many bugs were hopefully fixed. Please try out the latest 3.x series of NuGet packages (currently in prerelease). To try and make the project more maintainable in my spare time going forward, I've decided to close all existing issues to start with a clean slate. If you're still experiencing this issue on the newest version, please open a new issue with as much detail as possible. Thank you for your patience and understanding! Happy scanning!