问题
I'm executing below code for text-to-speech project on device, but getting error "Building MacinTalk voice for asset: (null)" Please any help on how I can fix or any tips what's going wrong.
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc]init];
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:@"Tips For Silicon Valley From A Startup Accelerator In Gaza"];
[utterance setRate:0.015f];
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-GB"];
[synthesizer speakUtterance:utterance];
回答1:
If it the same as I am seeing then it is not really an error - it is an output to the log and a minor annoyance but can be ignored. The reference 'null' is worrying but the speechSynthesizer is still working and talking correctly and users will not see this message on real devices. I have only seen this since iOS9, possibly a log event turned on during development that they forgot to turn off.
回答2:
I have log error like that (Building MacinTalk voice for asset: (null)) I don't know why, but if your project don't show sound in device I think you forgot allow activating an audio session.
import AVFoundation
///
do{
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
do{
try AVAudioSession.sharedInstance().setActive(true)
}catch{
}
}catch{
}
来源:https://stackoverflow.com/questions/32774480/why-im-getting-building-macintalk-voice-for-asset-null-in-ios-device-test