Korzystanie z interfejsu API Google Text-To-Speech (TTS) w systemie iOS

Korzystam z interfejsu API z tym kodem:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"file.mp3"];

NSString *text = textToTranslate; //@"You are one chromosome away from being a potato.";
NSString *urlString = [NSString stringWithFormat:@"http://www.translate.google.com/translate_tts?tl=en&q=%@",text];
NSURL *url = [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url] ;
[request setValue:@"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1" forHTTPHeaderField:@"User-Agent"];
NSURLResponse* response = nil;
NSError* error = nil;
NSData* data = [NSURLConnection sendSynchronousRequest:request
                                     returningResponse:&response
                                                 error:&error];
[data writeToFile:path atomically:YES];

SystemSoundID soundID;
NSURL *url2 = [NSURL fileURLWithPath:path];

AudioServicesCreateSystemSoundID((__bridge CFURLRef)url2, &soundID);
AudioServicesPlaySystemSound (soundID);

Który działa, ale tylko na krótkich zdaniach (mniej niż 10 słów). Co robię źle? Jak mogę rozwiązać ten problem lub oddzielić go na kilka tekstów bez obniżania jakości mowy?

questionAnswers(2)

yourAnswerToTheQuestion