NativeScript / mlkit

Apache License 2.0
24 stars 9 forks source link

IOS Bug: onDetection method is never called #10

Closed cjohn001 closed 2 years ago

cjohn001 commented 2 years ago

You can see the problem in the attached debugger screenshot:

The relevant code is here https://github.com/NativeScript/mlkit/blob/c7ee4981e0457293e655d75dbf83b643fac48606/packages/mlkit-core/index.ios.ts#L205

It looks like the function is called with the wrong context. The "this" pointer seems to not point to the MLKitView object but rather a different NativeScriptGlobal object, like you can see in the debugger

this.detectionType = undefined for it, hence the onDetection method gets never called.

Bildschirmfoto 2021-12-06 um 21 50 24

You can try with the demo app at:

https://github.com/cjohn001/mlkit-test/

Just run on IOS device and set a breakpoint to:

https://github.com/NativeScript/mlkit/blob/c7ee4981e0457293e655d75dbf83b643fac48606/packages/mlkit-core/index.ios.ts#L205