iosuitextfielduitextviewsiridictation

Dictation results for UITextField different than UITextView


I can't seem to find any documentation on the speech to text option for text entry in iOS. I know you can do it manually with some the AV stuff, but the out of the box dictation you get when Siri is enabled has some quirks to it.

Try this. Open any iOS app you have with a search bar. This will be our UITextField experiment. Better yet, open Mail.app. You can't uninstall it, so I know you have it.

Say "123 Elm St. comma Fargo comma ND" What I get: 123 Elm St. comma Fargo comma Indy"

Pretty close to exactly what I said. No big deal right. That was a text field/search bar. Lets try this in a UITextView.

Open a new email, and go to the body of the email. Lets say the same thing.

Say "123 Elm St. comma Fargo comma ND" What I get: 123 Elm St., Fargo, ND"

That looks loads better! So what I want to know is, why does the UITextView get better recognition for punctuation and other commands than text fields do. This isn't just limited to commas, it goes across the whole spectrum.

Is there a way to specify what type of text I want dictated? Is there a way to change it so I get this punctuation recognition in a text field? Or can someone point me to some documentation that says this is why they are different and I'm totally screwed. Either way, some answers would be helpful. Thanks in advance.

UPDATE I've subclassed UITextField and checked for alternate phrases that might be coming back with the dictation, but there aren't. Just the original conversion is all I get.


Solution

  • After playing around with the text field some more, and using some information from @Ricky, I figured out what is holding the dictation back. I was setting the returnKeyType to UIReturnKeySearch. Changing this to any of the other options gives me the dictation results I wanted. Changing back to Search and the results are full text results. This isn't documented anywhere.

    This behavior isn't documented anywhere. Thanks to @Ricky for steering my thinking, even if it wasn't 100% the right answer. It did help me get to the bottom of the issue.