I have been searching for a code sample for how to use these APIs for a long time. As far as I can tell there are no code samples for this, either put out by Xamarin or Apple. As I am using MonoTouch, I thought I should ask here on Xamarin first.
You might think it was obvious how to use these APIs, but unfortunately not to me.
The APIs in question are the ones referenced on this page: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInput_Protocol/Reference/Reference.html
In particular:
– dictationRecordingDidEnd
– dictationRecognitionFailed
– insertDictationResult:
– insertDictationResultPlaceholder
– frameForDictationResultPlaceholder:
– removeDictationResultPlaceholder:willInsertResult:
Also apparently there is a class called: "UIDictationPhrase" ... but I don't know how this relates to the above. (Which is part of the problem.)
I have also been attempting to understand this:
Something that has helped a bit is this Xamarin sample...
https://github.com/xamarin/monotouch-samples/tree/master/SimpleTextInput
which shows how to use "UITextInput" to code up custom text input.
Unfortunately it leaves out the dictation methods which are also a part of "UITextInput".
says: "A dictation phrase object represents the textual interpretation of a spoken phrase as dictated by a user.
Starting in iOS 5.1, when the user chooses dictation input on a supported device, the system automatically inserts recognized phrases into the current text view. You can use an object of the UIDictationPhrase class to obtain a string representing a phrase a user has dictated. In the case of ambiguous dictation results, a dictation phrase object provides an array containing alternative strings. **** Methods in the UITextInput protocol allow your app to respond to the completion of dictation. **** "
But the page does not provide any clues as to how to do this... in other words: how do bring together UIDictationPhrase with any of the APIs I have listed above.