我刚刚下载了适用于iOS开发的Dragon Mobile SDK,并尝试使用SpeechKit创建应用。我遵循了Dragon Mobile SDK Reference,但我在日志中不断收到以下消息:
2014-12-11 23:24:52.834 TestApp[17554:1036858] [NMSP_DEBUG] nmsp_nmas_create_dictionary().
2014-12-11 23:24:52.835 TestApp[17554:1036858] [NMSP_DEBUG] nmsp_nmas_dictionary_add().
2014-12-11 23:24:52.835 TestApp[17554:1036858] [NMSP_DEBUG] nmsp_nmas_dictionary_key_exists
2014-12-11 23:24:52.835 TestApp[17554:1036858] [NMSP_DEBUG] nmsp_nmas_dictionary_add().
2014-12-11 23:24:52.836 TestApp[17554:1036858] [NMSP_DEBUG] nmsp_nmas_dictionary_key_exists
这是我的代码:
- (IBAction)startRecording:(id)sender {
self.vocalizer = [[SKVocalizer alloc] initWithLanguage:@"en_US"
delegate:self];
[self.vocalizer speakString:@"Hello world."];
}
运行代码时没有任何反应。我已经仔细检查并确保密钥正确,并且我已经下载了正确的框架,所以我不知道问题是什么。任何帮助将不胜感激!
答案 0 :(得分:1)
只是弄清楚为什么会这样!我在AppDelegate中添加了以下函数(根据Ray Wenderlich的教程)
- (void)setupSpeechKitConnection {
[SpeechKit setupWithID:INSERT_YOUR_APPLICATION_ID_HERE
host:INSERT_YOUR_HOST_ADDRESS_HERE
port:INSERT_YOUR_HOST_PORT_HERE
useSSL:NO
delegate:nil];
// Set earcons to play
SKEarcon* earconStart = [SKEarcon earconWithName:@"earcon_listening.wav"];
SKEarcon* earconStop = [SKEarcon earconWithName:@"earcon_done_listening.wav"];
SKEarcon* earconCancel = [SKEarcon earconWithName:@"earcon_cancel.wav"];
[SpeechKit setEarcon:earconStart forType:SKStartRecordingEarconType];
[SpeechKit setEarcon:earconStop forType:SKStopRecordingEarconType];
[SpeechKit setEarcon:earconCancel forType:SKCancelRecordingEarconType];
}
但它没有被召唤。当我将它移动到ViewController中的viewDidLoad时,它开始工作。