I have created one React Native application for barcode/QRCode scanning functionality. I used third party barcode scanner library.I am able to scan barcode properly, but application getting crashed on QR code scan.Here is sample code:
- (void)captureOutput:(AVCaptureOutput *)output didOutputMetadataObjects:(NSArray<__kindof AVMetadataObject *> *)metadataObjects fromConnection:(AVCaptureConnection *)connection{ for (AVMetadataObject *object in metadataObjects) { if ([object isKindOfClass:[AVMetadataMachineReadableCodeObject class]]) { if (_callback != nil) { _callback(@{ @"format": object.type, @"content": [(AVMetadataMachineReadableCodeObject *)object stringValue] }); }}
}}
it returns nil when I am trying scan QR code and application is getting crash on this line
[(AVMetadataMachineReadableCodeObject *)object stringValue]
and getting exception error is
-[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]