Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ionic framework 如何解决摄像头不可用的问题_Ionic Framework_Ionic4_Ionic Native - Fatal编程技术网

Ionic framework 如何解决摄像头不可用的问题

Ionic framework 如何解决摄像头不可用的问题,ionic-framework,ionic4,ionic-native,Ionic Framework,Ionic4,Ionic Native,我在尝试打开qrcode插件的摄像头时出现此错误 我的代码: scancode() { this.qrScanner.prepare() .then((status: QRScannerStatus) => { if (status.authorized) { // camera permission was granted // start scanning let scanSub = this.qrScanner.

我在尝试打开qrcode插件的摄像头时出现此错误

我的代码:

scancode() {
this.qrScanner.prepare()
    .then((status: QRScannerStatus) => {
      if (status.authorized) {
        // camera permission was granted

        // start scanning
        let scanSub = this.qrScanner.scan().subscribe((text: string) => {
          console.log('Scanned something', text);

          this.qrScanner.hide(); // hide camera preview
          scanSub.unsubscribe(); // stop scanning
        });

      } else if (status.denied) {
        // camera permission was permanently denied
        // you must use QRScanner.openSettings() method to guide the user to the settings page
        // then they can grant the permission from there
        this.qrScanner.openSettings();
        window.document.querySelector('ion-app').classList.add('transparent-body');
      } else {
        // permission was denied, but not permanently. You can ask for permission again at a later time.
        this.qrScanner.openSettings();
        window.document.querySelector('ion-app').classList.add('transparent-body');
      }
    })
    .catch((e: any) => console.log('Error is', e));
window.document.querySelector('ion-app').classList.add('transparent-body');
}

我到处找,没有找到答案