ASRAudioRecorderListener error : 8, debugMsg : Received Nack - Server authentication fail
2020-12-04 18:37:42.366305+0900 ChatBot[1026:231858] error : 12, debugMsg : Auth fail.
2020-12-04 18:37:42.366326+0900 ChatBot[1026:231858] ASRAudioRecorderUQ::finalizeUnit() in.
onErrorOccured errorCode : MTSpeechRecognizerError, message : Optional(“Auth fail.”)
2020-12-04 18:37:42.367504+0900 ChatBot[1026:231858] _uninitializeAudioSession in.
Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value: file ChatBot/ChatViewController.swift, line 414
2020-12-04 18:37:48.387127+0900 ChatBot[1026:231753] Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value: file ChatBot/ChatViewController.swift, line 414
(lldb)
Swift 로 채팅 앱 만드는 중 에러가 났습니다. ㅠㅠ
KAKAO_APP_KEY 는 네이티브 앱 키로 설정 된 상태고 앱등록은 아직 안해서 앱스토어 아이디 URL은 없는 상태 입니다.
앱키는 d76182e1a4da7942c72c8d7f2e36e324 입니다.
스위프트로 변환한 소스는 다음과 같습니다. … 빠뜨린게 있을까요… ㅜ
{
if self.speechRecognizer != nil{
if self.speechRecognizer.checkIsWorking(){
print(“client lib is working”)
return
}
}
var config:NSMutableDictionary = NSMutableDictionary(object: selectedServiceType, forKey: SpeechRecognizerConfigKeyServiceType as NSCopying)
if self.selectedServiceType.isEqual(to: SpeechRecognizerServiceTypeWord){
config.setObject(“수지\n태연\n현아\n아이유\n효린”, forKey: SpeechRecognizerConfigKeyUserDictionary as NSCopying)
}
//audio session option 설정
var intOption = AVAudioSession.CategoryOptions.allowBluetooth
intOption = AVAudioSession.CategoryOptions.defaultToSpeaker
// config.setValue( intOption, forKey: SpeechRecognizerConfigKeyAudioType)
config.setValue(AVAudioSession.Category.playAndRecord, forKey:SpeechRecognizerConfigKeyAudioCategory)
//[config setValue:[NSNumber numberWithBool:YES] forKey:SpeechRecognizerConfigKeyAudioConfigOn];
config.setValue(1 ,forKey:SpeechRecognizerConfigKeyAudioConfigOn)
self.speechRecognizer = MTSpeechRecognizerClient(config: config as? [AnyHashable : Any])
self.speechRecognizer.delegate = self
self.speechRecognizer.startRecording()
}
{
func onReady() {
}
func onBeginningOfSpeech() {
}
func onEndOfSpeech() {
}
func onError(_ errorCode: MTSpeechRecognizerError, message: String!) {
print("onErrorOccured errorCode : \(errorCode), message : \(message)")
if self.speechRecognizer != nil{
self.speechRecognizer = nil
}
self.txtText.text = message
}
func onPartialResult(_ partialResult: String!) {
var result = partialResult!
if (result.count > 0) {
self.txtText.text = result
}
}
func onResults(_ results: [Any]!, confidences: [Any]!, marked: Bool) {
self.txtText.text = "";
if self.speechRecognizer != nil {
self.speechRecognizer = nil
}
var resultLabel:[String] = []
var boolList:Bool = true
if boolList {
var resultLabel:NSMutableString = NSMutableString(string: "result (confidence)\n")
// for i in 0 … results.count {
// resultLabel.append( String("%@%d (%d)\n",i, objectAtIndex:i], [[confidences objectAtIndex:i] intValue]]];
// }
//
// UIAlertView *resultAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedStringFromTable(@“resultList”, STRINGS_FILE_NAME, “result List.”)
// message:resultLabel
// delegate:self
// cancelButtonTitle:NSLocalizedStringFromTable(@“ok”, STRINGS_FILE_NAME, “ok.”)
// otherButtonTitles:nil, nil];
// [resultAlert show];
} else {
var result:String = results[0] as! String
self.txtText.text = result
}
}
func onAudioLevel(_ audioLevel: Float) {
}
func onFinished() {
}
}
인증 에러라는데 원인을 모르겠네요…
도와주세요!!