在OS X 10.9.4上使用Xcode 5.1.1时,请考虑以下代码片段:
- (IBAction)speak:(id)sender // text to loudspeaker, this works
{
[self setup]; // provide the synthesizer with its parameters
[speaker startSpeakingString: [textEntry stringValue]];
}
- (IBAction)storeSpeech:(id)sender // does not work
{
[self setup]; // provide the synthesizer with its parameters
[NSURL *outputFile =
[NSURL URLWithString:@"speech.aiff"];
[speaker startSpeakinString: [textEntry stringValue]
toURL:outputFile]; // the aiff-file is not created, why not?
}方法扬声器输出到计算机扬声器。这个可以正常工作。
方法storeSpeech不创建任何aiff文件。为什么不行?
发布于 2014-10-23 17:43:53
"speech.aiff“不是什么网址,对吧?
可以使用以file://开头的URL,也可以使用路径和创建文件URL的方法。
https://stackoverflow.com/questions/26523713
复制相似问题