AVSpeechSynthesizer error AudioSession

后端 未结 4 466
轻奢々
轻奢々 2021-02-05 08:31

I\'m playing around with AVSpeechSynthesizer and always getting these errors:

ERROR:     >aqsrv> 65: Exception caught in (null) - error -66634
ERROR:     A         


        
4条回答
  •  再見小時候
    2021-02-05 08:46

    I get exactly the same error log in the Simulator but I have no problem with the code in either the Simulator or on the iPhone 5 device as you've indicated elsewhere. The difference might be that I'm not using any of those 6 optional AVSpeechSythesizerDelegates and consequently, I have not included it in my class protocol. Hence, to help track your error, you might try it without. Here is my test code, which is logically the same as yours, minus the delegate and any AVSpeechUtterance storage allocation:

    -(void)tts:(NSString*)text
    {
    
    #define MY_SPEECH_RATE  0.1666
    #define MY_SPEECH_MPX  1.55
    
        AVSpeechSynthesizer *textToSpeech = [[AVSpeechSynthesizer new]autorelease];
        NSString *language = [AVSpeechSynthesisVoice currentLanguageCode];
        if (language==nil) language = @"en-us";
        AVSpeechUtterance *speak = [AVSpeechUtterance speechUtteranceWithString:text];
        [speak setRate:MY_SPEECH_RATE];
        [speak setPitchMultiplier:MY_SPEECH_MPX];
        [speak setVoice:[AVSpeechSynthesisVoice voiceWithLanguage:language]];
        [textToSpeech speakUtterance:speak];
    }
    

    As you can see, I'm not using ARC but I don't think that makes the difference. (Also posted in the Developer's Forum)

提交回复
热议问题