New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Scanner Does Not Capture Barcodes #262

Closed
diloreto opened this Issue Jun 21, 2016 · 9 comments

Comments

Projects
None yet
4 participants
@diloreto

diloreto commented Jun 21, 2016

I have tried implementing this plugin several times, executing by building a phoneGap project, opening in Xcode, then building and pushing to my iPhone 6s+ (latest iOS). I can get the scanner to show up with a green box and red line through it, and then when I hover over barcodes, the debugger in Xcode shows data apparently, but the scanner does not stop reading/capture. I never get to the "success" function and must cancel it to get out.

  • Has anyone else experienced this? What did you do?
  • Is this unique to IPhone 6s+ ?
  • Is there better documentation for this plugin anywhere? This one is lacking; you cannot have an "options" parameter for a function and not specify exactly what can be passed?

Here is my code:

function scanItem(){

        var camOpt = {
              "preferFrontCamera" : false, // iOS and Android
              "showFlipCameraButton" : false, // iOS and Android
              "formats" : "", // I WANT TO SUPPORT ALL BARCODE FORMATS
              "prompt" : "Place a barcode inside the scan area", // supported on Android only
              "orientation" : "portrait" // Android only (portrait|landscape), default unset so it rotates with the device
          };

          cordova.plugins.barcodeScanner.scan(
          function (result) {
                          // Never enters on compiled app
              alert("We got a barcode\n" +
                    "Result: " + result.text + "\n" +
                    "Format: " + result.format + "\n" +
                    "Cancelled: " + result.cancelled);
          }, 
          function (error) {
              alert("Scanning failed: " + error);
          },
          camOpt
       );
}
@jcesarmobile

This comment has been minimized.

Collaborator

jcesarmobile commented Jun 21, 2016

I think you have to remove the "formats" : "" or use null instead of ""

@diloreto

This comment has been minimized.

diloreto commented Jun 21, 2016

Thank you - I'll give that a whirl. That still doesn't answer why when I
hover over barcodes with the barcode scanner open that it does not "pick
them up". Scanner continues to try.

On Tuesday, June 21, 2016, jcesarmobile notifications@github.com wrote:

I think you have to remove the "formats" : "" or use null instead of ""


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#262 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABRzCEVlTSaSecRETxxUqn6-98RW58GGks5qN81KgaJpZM4I6oji
.

Tony DiLoreto
tony.diloreto@gmail.com
http://www.tonydiloreto.com

*“If you only do what you can do, you'll never be better than what you are
now.” *
― Shifu

@songhlc

This comment has been minimized.

songhlc commented Jun 24, 2016

it works fine on my iphone5s
here is my code:

cordova.plugins.barcodeScanner.scan(
            function (result) {
                alert("We got a barcode\n" +
                    "Result: " + result.text + "\n" +
                    "Format: " + result.format + "\n" +
                    "Cancelled: " + result.cancelled);
                window.location.href="index.html#goods/goodsview?code="+result.text;
            },
            function (error) {
                alert("Scanning failed: " + error);
            },
            {
                "preferFrontCamera" : true, // iOS and Android
                "showFlipCameraButton" : true, // iOS and Android
                "prompt" : "Place a barcode inside the scan area", // supported on Android only
                "formats" : "QR_CODE,PDF_417,EAN_8,EAN_13", // default: all but PDF_417 and RSS_EXPANDED
                "orientation" : "landscape" // Android only (portrait|landscape), default unset so it rotates with the device
            }
        );
@diloreto

This comment has been minimized.

diloreto commented Jun 24, 2016

Thanks - and how are you envoking that? I'm doing a $$(element).on('click',
scanItem); which calls that. The scanner will pop up, but not pull the item
code. Have you seen this before?

On Thursday, June 23, 2016, 宋江凌 notifications@github.com wrote:

it works fine on my iphone5s
here is my code:

cordova.plugins.barcodeScanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
window.location.href="index.html#goods/goodsview?code="+result.text;
},
function (error) {
alert("Scanning failed: " + error);
},
{
"preferFrontCamera" : true, // iOS and Android
"showFlipCameraButton" : true, // iOS and Android
"prompt" : "Place a barcode inside the scan area", // supported on Android only
"formats" : "QR_CODE,PDF_417,EAN_8,EAN_13", // default: all but PDF_417 and RSS_EXPANDED
"orientation" : "landscape" // Android only (portrait|landscape), default unset so it rotates with the device
}
);


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#262 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABRzCMy_NMlQsd6-se7yleDbveTanhEtks5qO08WgaJpZM4I6oji
.

Tony DiLoreto
tony.diloreto@gmail.com
http://www.tonydiloreto.com

*“If you only do what you can do, you'll never be better than what you are
now.” *
― Shifu

@diloreto

This comment has been minimized.

diloreto commented Jun 25, 2016

User Error - I had to do a "Xcode Clean...Build" and it worked. Must have been stale compiled files.

@sokulski

This comment has been minimized.

sokulski commented Jun 25, 2016

I believe I am experiencing the same issue. I build using the Cordova CLI, I am starting the barcode scanner via a button, and I can see the camera with the overlay.

When looking from XCode I can see various "bits" items showing up in the console as I point my camera at a barcode. But the scan is not completing and firing either the success or failure functions.

I tried running Clean on the project in Xcode as well as Clean Build Folder with no relief.

Any idea what I should try next?

@diloreto

This comment has been minimized.

diloreto commented Jun 26, 2016

It's hard to say - I put this in as the new options parameter:

var camOpt = {
"preferFrontCamera" : false, // iOS and Android
"showFlipCameraButton" : false, // iOS and Android
"prompt" : "Place a barcode inside the scan area", // supported on Android
only
// "formats" : "EAN_8,EAN_13,QR_CODE", // Specify formats
"orientation" : "portrait" // Android only (portrait|landscape), default
unset so it rotates with the device
};

Recompiled from cordova, then cleaned the project in XCode, rebuilt and
pushed to IPhone and now works. Regardless the library probably could stand
a bit of an overhaul, as the only other library I found for barcode
scanning wanted some insane amount of money ($1k/yr +).

Try that.

On Sat, Jun 25, 2016 at 6:52 PM, StevenSokulski notifications@github.com
wrote:

I believe I am experiencing the same issue. I build using the Cordova CLI,
I am starting the barcode scanner via a button, and I can see the camera
with the overlay.

When looking from XCode I can see various "bits" items showing up in the
console as I point my camera at a barcode. But the scan is not completing
and firing either the success or failure functions.

I tried running Clean on the project in Xcode as well as Clean Build
Folder with no relief.

Any idea what I should try next?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#262 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABRzCJ9t5Yw6nC6wX_JHMZCB900oY3_pks5qPbEZgaJpZM4I6oji
.

Tony DiLoreto
tony.diloreto@gmail.com
http://www.tonydiloreto.com

*“If you only do what you can do, you'll never be better than what you are
now.” *
― Shifu

@sokulski

This comment has been minimized.

sokulski commented Jun 29, 2016

I was able to resolve this. I think it may have been a misconfiguration on my end. Either that or cleaning the project worked.

At any rate, don't keep this issue open on my account. Thanks!

@lock

This comment has been minimized.

lock bot commented Jun 8, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 8, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.