Onsen 2-Monaca CLI-Cordova插件条形码扫描仪
我正在使用Onsen 2和Monaca创建一个带有scandit扫描仪的条形码扫描仪应用程序。我将扫描库集成为插件 cordova插件添加。安卓和iPad的一切都很好,但对于iOS 10+,它表现出一种奇怪的行为。只有在我按下手机的home(主页)按钮并很快将应用程序恢复到前台后,摄像头才会打开,扫描仪工作正常 我在这里发现了一个类似的问题,但这里还没有答案。 在标记副本之前,请重新考虑我的问题,因为问题仍然悬而未决 下面是我的代码Onsen 2-Monaca CLI-Cordova插件条形码扫描仪,cordova,monaca,onsen-ui2,Cordova,Monaca,Onsen Ui2,我正在使用Onsen 2和Monaca创建一个带有scandit扫描仪的条形码扫描仪应用程序。我将扫描库集成为插件 cordova插件添加。安卓和iPad的一切都很好,但对于iOS 10+,它表现出一种奇怪的行为。只有在我按下手机的home(主页)按钮并很快将应用程序恢复到前台后,摄像头才会打开,扫描仪工作正常 我在这里发现了一个类似的问题,但这里还没有答案。 在标记副本之前,请重新考虑我的问题,因为问题仍然悬而未决 下面是我的代码 scan() { console.
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();
}
scan(){
console.log(“………..扫描点击………”);
(window.Scandit.License.setAppKey(“XXXXXXXXXXXXXXXXXX”);
var settings=new(window.Scandit.ScanSettings();
settings.setSymbologyEnabled((窗口).Scandit.Barcode.Symbology.EAN13,true);
settings.setSymbologyEnabled((窗口).Scandit.Barcode.Symbology.UPC12,true);
settings.setSymbologyEnabled((窗口).Scandit.Barcode.Symbology.EAN8,true);
var picker=new(窗口).Scandit.BarcodePicker(设置);
picker.show(成功、空、失败);
功能成功(会话){
警报(“已扫描”+session.NewlyRecognitizedCodes[0]。符号+“代码:”+session.NewlyRecognitizedCodes[0]。数据);
session.stopscan();
}
功能手册(目录){
ons.notification.alert(“手册:+内容”);
}
功能故障(错误){
ons.notification.alert(“失败:+错误”);
}
picker.startScanning();
}
谢谢你的帮助
感谢您在“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';">