[Barcode Plugin] Error scanning barcode: wrong parameter camera direction
Question
barcode-plugin
Mobile icon
Forge component by Platform Maintenance
Application Type
Mobile
Service Studio Version
11.11.10 (Build 46735)
Platform Version
11.12.1 (Build 30548)

Hello team,

The action ScanBarcode returns the following error when it is used on an iPhone:

Error scanning barcode. Error code: 3 and error message: Wrong parameter camera direction can only be backCamera or frontCamera. Defaults to backCamera.

Android does not show this error. This issue only happens with version 5.0.0 of the plugin so right now we have use version 4.2.1. We have tried to solve the issue by explicitly giving the parameter Entities.CameraDirection.BackCamera to the action but the issue remains. Could you help us with issue?

Kind regards,

Sofía J.


Same same. 

  • iOS build
  • MABS 8.0
  • plugin version 5.0.5
  • Scan fails with "Wrong parameter camera direction can only be backCamera or frontCamera. Defaults to backCamera."

I've tried filling CameraDirection parameter and leaving it empty, same results. 

After digging a bit on Cordova plugin details, this error msg comes from https://github.com/OutSystems/cordova-outsystems-barcodescanner/blob/main/src/ios/OSBarcodeScanner.m (line 25), where source expects a value from entity identifier (1 for Entities.CameraDirection.BackCamera, 2 for Entities.CameraDirection.FrontCamera).

Instead of just erroring out, could this be modified to actually use the default value mentioned in documentation

I don't know if it's related or not, but by looking at the Cordova javascript glue code (https://github.com/OutSystems/cordova-outsystems-barcodescanner/blob/main/www/OSBarcodeScanner.js), it seems logic has a bug where integer value for CameraDirection set in Service Studio is overwritten by string value "front" or "back".

Hello OutSystems Community!

First of all, thank you for your questions. We have released a new version of the Barcode Plugin (v.5.0.6) which solves this issue with the ScanBarcode action parameters.

Please let us know if you have any other doubts.


Best regards,

Alexandre Jacinto

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.