我正在为新的Apple Watch创建一个应用程序。我想使用文字转语音功能。现在,我使用旧代码(iPhone):
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init];
speechPaused = YES;
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:@""];
utterance.rate = 0.15;
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"it_IT"];
[synthesizer speakUtterance:utterance];
在我的模拟器中,它可以正常用于手表。
我很困惑,因为我在几个论坛上都读过不可能使用文字转语音。 我想知道我的代码是否适用于真正的 Apple Watch。
谢谢。
答案 0 :(得分:1)
这是不可能的。一般来说,WatchKit现在非常有限。第三方开发者目前无法播放Apple Watch的音频(来源:Apple员工通过开发者论坛)。
请参阅here可能的内容。
答案 1 :(得分:1)
根据developer.apple.com的文档,AVSpeechSynthesizer API可用于watchOS 2 +。
此外,截至2017年6月9日,我可以验证我可以在实际设备上播放AVSpeechUtterance,系列0 Apple Watch,38mm,可以从内置扬声器或通过蓝牙播放耳机(BeatsX)。