4

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.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Veejay
  • 397
  • 3
  • 10
  • 17

1 Answers1

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

or

in console tab print

 po words
Aditya Srivastava
  • 2,630
  • 2
  • 13
  • 23
Bhawin Ranpura
  • 129
  • 1
  • 8