4

I would like to detect when the user uses the iOS keyboard microphone to add text to a UITextField. So, after the keyboard comes up for text input, as soon as they use the dictation microphone even once, a flag will be set indicating that they have used speech input. I need to do this for usage analytics purposes.

I tried trapping dictationRecordingDidEnd according to this:

https://developer.apple.com/documentation/uikit/uitextinput

And ran into the same problem the author here had: dictationRecordingDidEnd never called

In that the method never seems to execute. Is there another way to detect speech input?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Brian Colavito
  • 881
  • 2
  • 9
  • 19

1 Answers1

1

MyThis is an adopted protocol, so you need to override the method. This worked for me running under iOS 8.1.1:

#import <UIKit/UIKit.h>

@interface MyTextField : UITextField

@end


#import "MyTextField.h"

@implementation MyTextField

- (void) dictationRecordingDidEnd {
    printf("dictationRecordingDidEnd\n");
}

@end
Mike
  • 3,084
  • 1
  • 25
  • 44