BlinkID / blinkid-react-native

ID scanning for cross-platform apps built with ReactNative.
175 stars 59 forks source link

Crash after scanning #171

Open jcbdev opened 3 years ago

jcbdev commented 3 years ago

I have an issue with the react-native module on an ios device.

Sometimes I can scan a document once but every time after that (and sometime the first time) I get the follow error EXC_BAD_ACCESS as is in the following screenshot

Screenshot 2021-01-01 at 19 45 27

I suspect this is something to do with the lifecycle of functional react-native components. Any idea why this could be occurring?

Thanks.

EDIT

More info - works fine on android but not iphone device. Tested with react-native v0.63.2 and v0.63.4 and BlinkId 5.6.0 and 5.9.0 and same issue.

juraskrlec commented 3 years ago

Hi @jcbdev

can you please tell me are you getting this on our sample app or do you have your own implementation and if that's the case, can you please tell us your steps to reproduce it? Do you have maybe some small sample where we can see what's going on? I am testing this with our sample app, and I am not able do get this error.

Thanks.

jcbdev commented 3 years ago

For me it's doing it on a newly created react-native project on a real ios mobile device. I can try and put a repro together (but I have major time constraints at the moment) but essentially if you create a new react-native project. Add blink and then call the scanner from a page with the following code

// eslint-disable-next-line react/prefer-stateless-function
class Scanner extends React.Component {
  constructor(props) {
    super(props);
  }

  async scan() {
    const mrtdCombinedRecognizer = new BlinkIDReactNative.MrtdCombinedRecognizer();
    mrtdCombinedRecognizer.returnFullDocumentImage = true;
    mrtdCombinedRecognizer.returnFaceImage = true;

    const passportRecognizer = new BlinkIDReactNative.PassportRecognizer();
    passportRecognizer.returnFullDocumentImage = true;
    passportRecognizer.returnFaceImage = true;

    // BlinkIDCombinedRecognizer automatically classifies different document types and scans the data from
    // the supported document
    const blinkIdCombinedRecognizer = new BlinkIDReactNative.BlinkIdCombinedRecognizer();
    blinkIdCombinedRecognizer.returnFullDocumentImage = true;
    blinkIdCombinedRecognizer.returnFaceImage = true;

    const scanningResults = await BlinkIDReactNative.BlinkID.scanWithCamera(
      new BlinkIDReactNative.DocumentVerificationOverlaySettings({
        enableBeep: true,
      }),
      new BlinkIDReactNative.RecognizerCollection([passportRecognizer, mrtdCombinedRecognizer, blinkIdCombinedRecognizer]),
      licenseKey,
    );

    return scanningResults;
  }

  render() {
    return <></>;
  }
}

Every time I do this then I get the error above when I scan on an iphone 10x and iphone 10xs. (ios 13)

mparadina commented 3 years ago

Hi @jcbdev

Do you maybe have any additional steps that you did along the way, or these steps mentioned above are the only ones you need to reproduce the issue?

Also, just to double-check, do you get the same behavior with our sample application when you try to run it?

Regards, Milan

jcbdev commented 3 years ago

Did you try this on a real ios device? It still happens for me event with the sample project.

mparadina commented 3 years ago

Hi @jcbdev

Does the issue also happen when you only leave the BlinkIdCombinedRecognizer in the RecognizerCollection?

We recommend only using the BlinkID recognizer in this configuration since both the Passport and MRTD recognizers have been deprecated since version 5.8.0. Therefore, it is advised to use the BlinkID recognizer instead.

Regards, Milan