Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: QR code read from file on iOS #217

Closed
5 of 11 tasks
elzone opened this issue Dec 22, 2024 · 19 comments
Closed
5 of 11 tasks

bug: QR code read from file on iOS #217

elzone opened this issue Dec 22, 2024 · 19 comments

Comments

@elzone
Copy link

elzone commented Dec 22, 2024

Plugin(s)

  • Barcode Scanning
  • Face Detection
  • Face Mesh Detection
  • Selfie Segmentation
  • Translation

Version

6.2.0

Platform(s)

  • Android
  • iOS
  • Web

Current behavior

When try to read QR code from file on iOS device, get the blank result with such trace from Xcode terminal:

INFO: Initialized TensorFlow Lite runtime.
2024-10-10 23:36:53.464352+0400 App[14160:3222069] Created TensorFlow Lite XNNPACK delegate for CPU.
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
⚡️  TO JS undefined
⚡️  To Native ->  FilePicker pickImages 34251905
2024-10-10 23:37:00.285120+0400 App[14160:3222069] [Assert] +[UIInputViewSetPlacementInvisible placementWithPlacement:]: Should not be called with an invisible placement
2024-10-10 23:37:00.585361+0400 App[14160:3222069] [Assert] +[UIInputViewSetPlacementInvisible placementWithPlacement:]: Should not be called with an invisible placement
2024-10-10 23:37:00.585568+0400 App[14160:3222069] [Assert] +[UIInputViewSetPlacementInvisible placementWithPlacement:]: Should not be called with an invisible placement
2024-10-10 23:37:00.585591+0400 App[14160:3222069] [Assert] +[UIInputViewSetPlacementInvisible placementWithPlacement:]: Should not be called with an invisible placement
2024-10-10 23:37:00.585619+0400 App[14160:3222069] [Assert] +[UIInputViewSetPlacementInvisible placementWithPlacement:]: Should not be called with an invisible placement
⚡️  TO JS {"files":[{"path":"file:\/\/\/var\/mobile\/Containers\/Data\/Application\/948ACED3-E3BC-4BC9-B7D1-FC2F1B33B0E1\/Library\/Caches\/8F35E02D-CCD7-4C96-B961-9D693CEB89DA\/IMG_5892.png","modifiedAt":1728317065793,"height":2436,"name":"IMG_5892.png","size":67321
⚡️  To Native ->  BarcodeScanner readBarcodesFromImage 34251906
2024-10-10 23:37:01.358173+0400 App[14160:3222314] [Unknown process name] 
CGBitmapContextCreate: unsupported parameter combination:
	Gray | 16 bits/component, integer | 1125 bytes/row.
	kCGImageAlphaNone | kCGImageByteOrderDefault | kCGImagePixelFormatPacked
Set CGBITMAP_CONTEXT_LOG_ERRORS environmental variable to see more details.
2024-10-10 23:37:01.358252+0400 App[14160:3222314] [Unknown process name] CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
2024-10-10 23:37:01.358282+0400 App[14160:3222314] [Unknown process name] CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
2024-10-10 23:37:01.358307+0400 App[14160:3222314] [Unknown process name] CGContextDrawImage: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
⚡️  TO JS {"barcodes":[]}

Expected behavior

When read QR code from file on iOS should return QR code data.

Reproduction

https://github.com/elzone/qr-code-issue

Steps to reproduce

  1. Prepare app for iOS from sources (github link)
  2. Run the app on iOS device (from 16.0 iOS version)
  3. Press the button on the screen
  4. Select file with QR code
  5. In Xcode terminal check the message from plugin (see Current behavior section)

Other information

No response

Capacitor doctor

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 6.2.0
@capacitor/core: 6.2.0
@capacitor/android: 6.2.0
@capacitor/ios: 6.2.0

Installed Dependencies:

@capacitor/core: 6.2.0
@capacitor/cli: 6.2.0
@capacitor/android: 6.2.0
@capacitor/ios: 6.2.0

[success] iOS looking great! 👌

Before submitting

  • I have read and followed the bug report guidelines.
  • I have attached links to possibly related issues and discussions.
  • I understand that incomplete issues (e.g. without reproduction) are closed.
@elzone elzone added bug/fix Something isn't working needs: triage labels Dec 22, 2024
@robingenz
Copy link
Member

Thank you for your request. Please provide a Minimal (!), Reproducible Example using this template in a public GitHub repository so I can debug the issue.

Copy link
Contributor

This issue has been labeled as needs: reproduction. This label is added to issues that need a code reproduction.

Please provide a Minimal, Reproducible Example using this template in a public GitHub repository so we can debug the issue.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for us to reproduce the issue.

@robingenz
Copy link
Member

i prepared my own repo (please check this link - elzone/qr-code-issue). is it not enough for test/debug?

This is not a minimal, reproducible example. There are a lot of dependencies that are not needed. I'm also not familiar with React.

@elzone
Copy link
Author

elzone commented Dec 23, 2024

hi Robin,
here is the repo:
https://github.com/elzone/barcode-reader-ios-issue-read-from-file

@robingenz
Copy link
Member

Which image can I use to reproduce this?

@elzone
Copy link
Author

elzone commented Dec 23, 2024

please try these
photo_2024-12-23 12 00 43
photo_2024-12-23 12 00 33

@robingenz
Copy link
Member

Unfortunately, I cannot reproduce your issue.

ScreenRecording_12-25-2024.09-05-39_1.1.MP4

The example works without problems (I've just replaced console.log with alert).

@elzone
Copy link
Author

elzone commented Dec 25, 2024

hi Robin,
can you tell me which iOS version and device do you use?
and the second image with QR code also work fine?

@elzone
Copy link
Author

elzone commented Dec 25, 2024

and what about this error (in my case):

2024-10-10 23:37:01.358173+0400 App[14160:3222314] [Unknown process name] CGBitmapContextCreate: unsupported parameter combination: Gray | 16 bits/component, integer | 1125 bytes/row. kCGImageAlphaNone | kCGImageByteOrderDefault | kCGImagePixelFormatPacked Set CGBITMAP_CONTEXT_LOG_ERRORS environmental variable to see more details.

@robingenz
Copy link
Member

iPhone 13 with iOS 18.1.1. I've only tested the first image.

@elzone
Copy link
Author

elzone commented Dec 25, 2024

can you check the second one too, please?

@robingenz
Copy link
Member

The second one also works.
IMG_4247

@elzone
Copy link
Author

elzone commented Dec 25, 2024

Hm, interesting
On my device (iPhone X with iOS 16.7.10) both images show the issue.

As i understand - here we don't need any specific iOS permissions, right?

@robingenz
Copy link
Member

No, you don't need any specific permissions.

@elzone
Copy link
Author

elzone commented Dec 25, 2024

i see.
will try to check on other devices (model and os version)
will put results here

@elzone
Copy link
Author

elzone commented Dec 26, 2024

For other devices (with iOS 18.1 for example) - for some images with QR codes all ok, but not for all.
Not clear for me the reason why

@robingenz
Copy link
Member

This seems to be a problem with the ML Kit SDK and not with the plugin. Maybe create an issue in https://github.com/googlesamples/mlkit. The issue must be reproducible in any case, otherwise it's hard to help you. I will close this issue for now.

@aliyafthh
Copy link

@elzone Did you manage to find a fix for this? I am also facing the same issue of receiving blank result from barcode reader for both QR and barcodes but only in iOS 16. iOS 18 is okay for me

@elzone
Copy link
Author

elzone commented Jan 9, 2025

hi. no. as Robin mentioned, this error mostly depend on mlkit. have to add bug report there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants