Skip to content

zBar not showing on iOS 11 even with #122 or #120 patch #129

@matthieu-brillaxis

Description

@matthieu-brillaxis

Hi,

I try to use zbar on iOS 11, but when I launch my function to scan barcode, it did not show the camera. And if I click again on the button to start a scan, it shows an alert with "A scan is already in progress".
This happen only on my ipad mini with iOS 11.2.1, I tried on Iphone 6 with iOS 10.3.3 and it display the camera.

On my iPad with iOS 11, i tried this two solutions #122 and #120 , but I get the same error.
It works on iPhone and Android with the plugin or with #120 or #122 patch.

I get the following error on xCode 9 console :

WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSRangeException>

How can I make it work on iOS 11 ?
I really need your help, I think @phongphan can help me.

Cordova version : 8.0.0
Platforms :

  • iOS : 4.5.4
  • Android : 6.4.0

Devices :

  • iPhone 6 : iOS 10.3.3
  • iPad mini 2 : iOS 11.2.1
  • Samsung galaxy S6 : Android 7.0

My code :

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Security-Policy" content="default-src * gap: ; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
        <meta name="format-detection" content="telephone=no">
        <meta name="msapplication-tap-highlight" content="no">
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
        <link rel="stylesheet" type="text/css" href="css/index.css">
        <title>Hello World</title>
    </head>
    <body>
        <div class="app">
            <h1>Test barcode</h1>
            <button onclick="testFunc()">Scan</button>
        </div>
        <script type="text/javascript" src="cordova.js"></script>
        <script>
            function testFunc() {
                var params = {
                    text_title: "OPTIONAL Title Text - default = 'Scan QR Code'", // Android only
                    text_instructions: "OPTIONAL Instruction Text - default = 'Please point your camera at the QR code.'", // Android only
                    camera: "back", // defaults to "back"
                    flash:"auto", // defaults to "auto". See Quirks
                    drawSight: true //defaults to true, create a red sight/line in the center of the scanner view.
                }
                cloudSky.zBar.scan(params, onSuccess, onFailure);
            }
            
            function onSuccess(s) {
                alert(s);
            }

            function onFailure(s) {
                alert(s);
            }
        </script>
    </body>
</html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions