h34*_*4cr 19 objective-c avfoundation ios avaudiosession
我正在玩AVSpeechSynthesizer并且总是遇到这些错误:
ERROR: >aqsrv> 65: Exception caught in (null) - error -66634
ERROR: AVAudioSessionUtilities.h:88: GetProperty_DefaultToZero: AudioSessionGetProperty ('disa') failed with error: '?ytp'
Run Code Online (Sandbox Code Playgroud)
我的代码是:
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init];
[synthesizer setDelegate:self];
speechSpeed = AVSpeechUtteranceMinimumSpeechRate;
AVSpeechUtterance *synUtt = [[AVSpeechUtterance alloc] initWithString:[[self text] text]];
[synUtt setRate:speechSpeed];
[synUtt setVoice:[AVSpeechSynthesisVoice voiceWithLanguage:languageCode]];
[synthesizer speakUtterance:synUtt];
Run Code Online (Sandbox Code Playgroud)
有谁知道如何解决这些错误?
我得到了上面的代码,以最小的调整在模拟器上工作.
在[[self text] text]你的代码位可能是错的(这是该Exception caught in (null)错误将来自).下面的代码对我有用.
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init];
[synthesizer setDelegate:self]; // set your class to conform to the AVSpeechSynthesizerDelegate protocol
float speechSpeed = AVSpeechUtteranceMinimumSpeechRate;
AVSpeechUtterance *synUtt = [[AVSpeechUtterance alloc] initWithString:@"hello I am testing"];
[synUtt setRate:speechSpeed];
[synUtt setVoice:[AVSpeechSynthesisVoice voiceWithLanguage:[AVSpeechSynthesisVoice currentLanguageCode]]];
[synthesizer speakUtterance:synUtt];
Run Code Online (Sandbox Code Playgroud)
当我说"工作"时,我的意思是我在模拟器中听到了说出我的测试句的声音.
我还是看到了这个警告:
2013-09-21 11:37:56.454演讲[5550:3a03] 11:37:56.454错误:AVAudioSessionUtilities.h:88:GetProperty_DefaultToZero:AudioSessionGetProperty('disa')失败,错误:'?ytp'
Xcode 5似乎有一个缓慢的时间尝试#import <AVFoundation/AVFoundation.h>使用这个SpeechSynthesis代码的传统,在使用新的时候,事情似乎加速了很多@import AVFoundation;.
| 归档时间: |
|
| 查看次数: |
8175 次 |
| 最近记录: |