我正在开发一款Windows Phone 8应用程序。我在语音识别方面遇到了问题。 这是我的代码。
SpeechRecognizerUI recoWithUI= new SpeechRecognizerUI();
try
{
this.recoWithUI = new SpeechRecognizerUI();
// Start recognition (load the dictation grammar by default).
SpeechRecognitionUIResult recoResult = await recoWithUI.RecognizeWithUIAsync();
// Do something with the recognition result.
MessageBox.Show(string.Format("You said {0}.", recoResult.RecognitionResult.Text));
}
catch (Exception)
{
throw;
}
每次运行它时,都会转到App.xaml.cs类并指出这个问题
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
Debugger.Break(); // It focuses on this line.
}
}
您知道如何解决此问题吗? 感谢
答案 0 :(得分:1)
好的,所以我遇到了问题 一切都好。代码没问题 问题是SpeechRecognizerUI类语言是en-Us但我的手机语言是en-UK所以我做的是 只需将我的手机语言更改为en-Us即可使用。 感谢
答案 1 :(得分:0)
您是否在WMAppManifest.xml文件中启用了麦克风功能?
打开WMAppManifest.xml> “功能”标签>检查ID_CAP_MICROPHONE。