afriscic / BarcodeScanning.Native.Maui

Barcode scanning library for .NET MAUI
https://www.nuget.org/packages/BarcodeScanning.Native.Maui
MIT License
162 stars 31 forks source link

Problem with iPhone 7 #43

Closed geertgeerits closed 5 months ago

geertgeerits commented 5 months ago

After I updated BarcodeScanning.Native.Maui from 1.1.1 to 1.4.0, the scanner no longer works on an old iPhone 7 with iOS 15.8.2. The camera itself still works, but the UI is frozen and no barcodes are recognized. None of the buttons work anymore. An iPhone 14 Pro and an iPad do work. There have of course also been other updates to .Net Maui and Visual Studio. The cause may also lie there. What could be the cause of this? Thanks in advance.

afriscic commented 5 months ago

Hello. Could you please roll back to 1.3.0/1.3.1 version and see if it works for you? @parigino1 reported in #37 that this version worked on iPhone 7. 1.4.0 didn't introduced any new functional changes so it shouldn't change iOS version requirements, but I did modify a lot of code so some unexpected bugs could be in there.

parigino1 commented 5 months ago

Hi, version 1.4.0 works for me on iPhone 7 (I have only this one), probably it doesn't work because of a wrong handle of the result? As quoted by @afriscic the OnDetectionFinished and OnDetectionFinishedCommand events now returns BarcodeResult[] instead of HashSet<BarcodeResult> Glad if I helped you!

afriscic commented 5 months ago

Oh, yes, I forgot to mention the most important part... But I assumed that the IDE would catch any type missmatch and not compile.

geertgeerits commented 5 months ago

Works OK with version 1.3.1. Thank you.

geertgeerits commented 5 months ago

Hi, Still the same problem with version 1.4.1. The scan page is not on the mainpage in my app. If I set the camera's 'CaptureQuality' to Low there is an improvement. The iPhone 7 sometimes responds to the buttons, but very slowly and not always. I don't know if this could have anything to do with it.

geertgeerits commented 5 months ago

Hi, still the same problem with version 1.4.2. I have crash reports from Sentry:

  1. System.NullReferenceException: Object reference not set to an instance of an object. https://geerits.sentry.io/share/issue/1d1d53b7d05649988bcd0a53c8d44ca1/
  2. App Hanging: App hanging for at least 2000 ms. https://geerits.sentry.io/share/issue/1d075320a6b54f46b169b54c0ce84715/
maictoa commented 5 months ago

Hi, I have the same issue on iPhone 8 with iOS 16.7.5. The last version where it works is version 1.3.1.

I need to upgrade to version 1.4.2 to resolve the issue #37 with the camera focus and resolution on dual camera devices.

afriscic commented 5 months ago

Hello.

As I don't have these older devices debugging is really impossible for me. I've gone over and over through code and found only one real difference between 1.3.1 and current version. I've created a new branch with potential fix. Please if you can do the following:

  1. Clone the master branch and run Barcodescanning.Test on your device to see how it works,
  2. Clone the issue-#43 branch and run Barcodescanning.Test on your device to see how it works.

Please report back afterwards.

maictoa commented 5 months ago

Thanks for your reply. I was just testing with version 1.4.2, if I set CameraEnabled=true then the UI doesn't respond but it can scan, however if CameraEnabled is set to false the UI responds to touch.

I will test and report back.

geertgeerits commented 5 months ago

Hi, The master branch did not solve the problem. For the issue-#43 branch I get the error: Git failed with a fatal error: repository not found.

afriscic commented 5 months ago

BarcodeScanning.Native.Maui-issue-43.zip

Here is a zip of the branch

geertgeerits commented 5 months ago

Hi, The issue-43 is working on a iPhone 7. Thank you very much.

afriscic commented 5 months ago

OK. Thank you for the feedback. It'll be a couple more days for a update as this code spawns threads like crazy so I'm a little bit afraid that it could cause thread starvation in some cases. So I need to figure out a solution for this before.

maictoa commented 5 months ago

Hi, just managed to test issue-#43 branch on iPhone 8 and it's still causing issues, the buttons don't respond and the device becomes hot. Sorry for the bad news, is there anything else you can try?

afriscic commented 5 months ago

I've pusshed some more minot tweaks today to issue-43 branch. See if it'll be any help.

maictoa commented 5 months ago

It's still not working on iPhone 8 but it works on iPhone 13. It appears that all processing power is being used by the scanning and leaves the UI unresponsive.

maictoa commented 5 months ago

I did a couple more tests (now with the correct branch) and it's working on iPhone 8 as well as on iPhone 13.

Thank your very much for your help fixing this issue, its very appreciated.

afriscic commented 5 months ago

I'll mark it as fixed in 1.4.3 Thank you all for your feedback