capacitor-community / barcode-scanner

A fast and efficient (QR) barcode scanner for Capacitor
MIT License
437 stars 169 forks source link

handle issue about background thread in ios #231

Closed josh-m-sharpe closed 1 year ago

josh-m-sharpe commented 1 year ago

Guessing we shouldn't be seeing this.
Using: @capacitor-community/barcode-scanner@3.0.3 Xcode 14.3 iPhone 13

I see this warning in xcode console when I invoke: BarcodeScanner.startScan()

⚡️  TO JS undefined
⚡️  To Native ->  BarcodeScanner startScan 65416664
Thread Performance Checker: -[AVCaptureSession startRunning] should be called from background thread. Calling it on the main thread can lead to UI unresponsiveness
PID: 3349, TID: 187904
Backtrace
=================================================================
3   CapacitorCommunityBarcodeScanner    0x0000000104ecb154 $s32CapacitorCommunityBarcodeScanner0cD0C4scan33_E9781981B91FA2D5C67BE1318BC971C3LLyyFyyScMYccfU1_ + 512
4   CapacitorCommunityBarcodeScanner    0x0000000104ec99f4 $sIeg_IeyB_TR + 48
5   libdispatch.dylib                   0x00000001052e4520 _dispatch_call_block_and_release + 32
6   libdispatch.dylib                   0x00000001052e6038 _dispatch_client_callout + 20
7   libdispatch.dylib                   0x00000001052f6798 _dispatch_main_queue_drain + 1196
8   libdispatch.dylib                   0x00000001052f62dc _dispatch_main_queue_callback_4CF + 44
9   CoreFoundation                      0x00000001c36fdd18 6A07CBE8-4F65-3DBC-B59D-C1A188A7B95D + 625944
10  CoreFoundation                      0x00000001c36df650 6A07CBE8-4F65-3DBC-B59D-C1A188A7B95D + 501328
11  CoreFoundation                      0x00000001c36e44dc CFRunLoopRunSpecific + 612
12  GraphicsServices                    0x00000001fe94435c GSEventRunModal + 164
13  UIKitCore                           0x00000001c5a7037c B0858D8E-7220-37BF-873F-ECC2B0A358C3 + 3789692
14  UIKitCore                           0x00000001c5a6ffe0 UIApplicationMain + 340
15  App                                 0x0000000104a5ffbc main + 64
16  dyld                                0x00000001e2b6cdec 41605DC7-F412-37D1-B51B-FEE1A26701E9 + 89580
thegnuu commented 1 year ago

We are aware of this "issue" and I am pretty sure it is fixed in the upcoming release, but I will have a look at it and double-check it :)

davidquon commented 1 year ago

I just encountered this issue as well. Are there any work arounds for this on iOS?

thegnuu commented 1 year ago

It is not an issue, it is a warning. The plugin works without any issues.

It is not ideal of course, but so far nobody had any issues because of this.

davidquon commented 1 year ago

I seem to only get a black screen when launching the barcode scanner. Here's what I'm using for Capacitor. Let me know if you have any suggestions of things I can try to get it working or if I can provide any further information. This is working on Android for me just not iOS. Thanks for your help.

  @capacitor/cli: 4.7.3
  @capacitor/core: 4.7.3
  @capacitor/android: 4.7.3
  @capacitor/ios: 4.7.3
davidquon commented 1 year ago

So the black screen issue is with an iPad 5th generation running iOS 16.2. I tested again on an iPhone 12 Pro running iOS 16.4.1 and it works as expected. My black screen issue is seemingly separate from this issue. Thanks for the help and feedback @thegnuu. 🍻

thegnuu commented 1 year ago

This is fixed in v5.0.0-beta.1 :)