3

我正在尝试使用 ionic3 进行语音识别插件,但我不断收到此错误

Ionic Native: deviceready did not fire within 5000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.

我在我的设计(iPhone iOS 10.1)中运行它,使用命令ionic cordova run ios -l

我已经解决了一些SO 问题/离子论坛问题,并尝试重新安装所有插件,按照他们的建议重新安装平台 (ios) + 插件,但仍然没有运气。

以下是我的课

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { SpeechRecognition } from '@ionic-native/speech-recognition';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  speechList: Array<string> = [];


  constructor(private speach: SpeechRecognition, public navCtrl: NavController) {

  }

  async getPermission():Promise<void> {
    console.log('abc1');
    try{
      const permission = await this.speach.requestPermission();
      console.log(permission);
      return permission;
    } catch (e){
      console.log(e);
    }
  }

  listenForSpeech():void {
    this.speach.startListening().subscribe(data => this.speechList = data, 
      error => console.log(error)
    )
  }
}

以下是我的离子信息

global packages:

    @ionic/cli-utils : 1.2.0
    Cordova CLI      : 7.0.0 
    Ionic CLI        : 3.2.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.2.1
    @ionic/cli-plugin-ionic-angular : 1.2.0
    Cordova Platforms               : ios 4.4.0
    Ionic Framework                 : ionic-angular 3.3.0

System:

    Node       : v7.10.0
    OS         : OS X El Capitan
    Xcode      : Xcode 7.3.1 Build version 7D1014 
    ios-deploy : 1.9.1 
    ios-sim    : 5.0.8
4

0 回答 0