2

I am trying to print the word that is being "spoken" by this app onto the console so I can store it in a variable for later use. The function is like so and I am trying to print the content within the variable "word". How would I go about this?

- (void)speak:(NSString *)words {
  if ([synth isSpeaking]) {
      NSLog(words);
    return;
  }
  AVSpeechUtterance *utterance =
      [AVSpeechUtterance speechUtteranceWithString:words];
  utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"];
  utterance.rate = 0.75 * AVSpeechUtteranceDefaultSpeechRate;
  [synth speakUtterance:utterance];

}

I have tried to add the NSLog(words) in there, as I thought that would be the way to approach this. However, I get an error and that does not work. I have added it in the code block above just for clarity in what I have done.

Flimzy
  • 68,325
  • 15
  • 126
  • 165
Veejay
  • 367
  • 3
  • 10
  • 17

1 Answers1

6
NSLog(@"words :: %@", words);

or

in console tab print

 po words
Aditya Srivastava
  • 2,595
  • 2
  • 11
  • 23