diff --git a/ios/Voice/Voice.m b/ios/Voice/Voice.m index 73a2cb4e..55801302 100644 --- a/ios/Voice/Voice.m +++ b/ios/Voice/Voice.m @@ -288,6 +288,13 @@ - (void)setupAndStartRecognizing:(NSString *)localeStr { self.speechRecognizer = [[SFSpeechRecognizer alloc] init]; } + if (self.speechRecognizer == nil) { + NSString *errorMessage = [NSString stringWithFormat: @"recognition is not supported for locale %@", localeStr]; + [self sendResult:@{@"code": @"recognition_fail", @"message": errorMessage} :nil :nil :nil]; + [self teardown]; + return; + } + self.speechRecognizer.delegate = self; // Start audio session...