robingenz / capacitor-mlkit-plugin-demo

⚡️ Simple Ionic Angular app to demonstrate the use of certain Capacitor ML Kit plugins.
MIT License
37 stars 22 forks source link

bug: the app doesn't work on IOS #12

Closed maelp closed 10 months ago

maelp commented 10 months ago

Describe the bug A clear and concise description of what the bug is.

Cloning this project, following the instructions, the app builds, but the barcode scanner does not work (see video, "start scanning" displays a black screen with the outline but no camera image and no scanning is done even if I point the phone to an image of a QR code, and scan doesn't even show a black screen, just the close and flashlight button on top of the app)

Additionally I had tried before to add the capacitor mlkit barcode scanning plugin in my own app and it had the same behavior so I think the plugin is broken on iOS)

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Clone the app Follow the build instructions on iOS

Test the barcode scanning function which doesn't work

Expected behavior A clear and concise description of what you expected to happen.

It should show an image, and should run the barcode detector on it

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

iPhone 11 with latest iOS

Additional context Add any other context about the problem here.

maelp commented 10 months ago

"Read barcode from image" works so I guess the MLKit binding works, it's really the AV capture which doesn't work properly

maelp commented 10 months ago

https://github.com/robingenz/capacitor-mlkit-plugin-demo/assets/15458/f05ed1e1-11a3-4f02-bf67-c4a13cc6f3e3

robingenz commented 10 months ago

Did you grant the camera permission?

maelp commented 10 months ago

Yes, but that doesn’t seem to be the issueOn Nov 1, 2023, at 18:29, Robin Genz @.***> wrote: Did you grant the camera permission?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

maelp commented 10 months ago

@robingenz does it work on your device?

robingenz commented 10 months ago

@robingenz does it work on your device?

Yes. For this reason I can't debug this issue. If you find the problem, feel free to create a PR.

https://github.com/robingenz/capacitor-mlkit-plugin-demo/assets/13857929/32bc0d48-3a50-430e-9d2c-5a53cd311c8e

maelp commented 10 months ago

hmmmm that's weird then... can you tell me what iPhone / iOS you have?

I'm on an iPhone 11, running iOS 17.0.3

maelp commented 10 months ago

Basically, just doing a clone of your repo, npm i, npm cap build ios, opening XCode, changing the signing account so that it builds, and running the app... I validate the camera permissions, and there is the bug.

I have tried modifying the swift code a bit, to move stuff on/off the main thread to see if that was the issue, but haven't found the bug

maelp commented 10 months ago

did you try deleting your previously installed demo app, rebuilding from scratch with the latest XCode?

I'm using XCode Version 15.0.1 (15A507)

maelp commented 10 months ago

huh... I retried by just opening the app and it worked... I guess it fails only when I'm using the app while connected to the XCode debugger somehow??

robingenz commented 10 months ago

I guess it fails only when I'm using the app while connected to the XCode debugger somehow??

Not on my side. But I'm glad that it's works now.