【问题标题】:Onsen 2 - Monaca CLI - Cordova plugins BarcodeScannerOnsen 2 - Monaca CLI - Cordova 插件 BarcodeScanner
【发布时间】:2017-07-23 09:48:28
【问题描述】:

我正在使用 Onsen 2 和 Monaca 创建带有 scandit 扫描仪的条形码扫描仪应用程序。我将扫描库集成为插件 科尔多瓦插件添加。在 Android 和 iPad 上一切正常,但对于 iOS 10+,它表现出奇怪的行为。只有在我按下手机的主页按钮并很快将应用程序恢复到前台后,相机才会打开,扫描仪工作正常。

我在这里发现了一个类似的问题,但这里还没有答案。 Onsen 2 - Monaca CLI - Cordova plugins weird behavior

请在标记重复之前重新考虑我的问题,因为问题仍然存在。

下面是我的代码

scan() {
    
        console.log('............scan clicked...........');
        
    (<any>window).Scandit.License.setAppKey(“xxxxxxxxxxxxxxxxxxxxx”);
        var settings = new (<any>window).Scandit.ScanSettings();
        settings.setSymbologyEnabled((<any>window).Scandit.Barcode.Symbology.EAN13, true);
        settings.setSymbologyEnabled((<any>window).Scandit.Barcode.Symbology.UPC12, true);
        settings.setSymbologyEnabled((<any>window).Scandit.Barcode.Symbology.EAN8, true);
        var picker = new (<any>window).Scandit.BarcodePicker(settings);
        picker.show(success, null, failure);
    
        function success(session) {
            alert("Scanned " + session.newlyRecognizedCodes[0].symbology + " code: " + session.newlyRecognizedCodes[0].data);
    
    
            session.stopScanning();
    
        }
        function manual(content) {
    
            ons.notification.alert("Manual: " + content);
    
        }
        function failure(error) {
            ons.notification.alert("Failed: " + error);
    
        }
    
        picker.startScanning();
    
    
    }

任何帮助表示赞赏 谢谢

【问题讨论】:

    标签: cordova monaca onsen-ui2


    【解决方案1】:

    改变“index.html”中的

    <meta http-equiv="Content-Security-Policy" content="img-src * 'self' data:; default-src * 'self' gap: wss: ws: ; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval';">
    

    对我有用

    感谢 Thumbal

    https://forum.ionicframework.com/t/cordova-inappbrowser-plugin-stopped-working-in-ios-10/64361/8

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多