我尝试运行下面的代码,该代码在模拟器上正常运行,但如果我在设备上运行,我会在Operation is not valid due to the current state of the object.
获得RecognizeWithUIAsync()
exception。< / p>
// Compile the dictation grammar
await speechRecog.CompileConstraintsAsync();
// Start Recognition
SpeechRecognitionResult speechRecognitionResult = await this.speechRecog.RecognizeWithUIAsync();
// Show Output
var sttDialog = new Windows.UI.Popups.MessageDialog(speechRecognitionResult.Text, "Heard You said...");
await sttDialog.ShowAsync();
其他一些信息: 我的方法是async;我检查了清单文件中的麦克风权限,我的设备上安装了四个声音。