WatchKit Text Input Controller

I am trying to use presentTextInputControllerWithSuggestions

in an application WatchKit

. I am not sure where I am going wrong.

presentTextInputControllerWithSuggestions(["Hello", "Hey"], completion: { 
    (myString) -> Void in
    println(myString)
    })

      

+3


source to share


3 answers


From the iOS 8.2 release note :



Watchkit

Known Issues

Real TextInputControllerWithSuggestions: Completion: The WKInterfaceController method is currently not supported in the iOS Simulator.

+7


source


You can try it by clicking on the offer. He must do the same as dictate. Remember that completion returns an array, not a string. You should do it like this:



self.presentTextInputControllerWithSuggestions(["Suggestion 1", "Suggestion 2"] allowedInputMode: .Plain, completion: { (selectedAnswers) -> Void in
    if reply && reply.count > 0 {
        if let spokenReply = selectedAnswers[0] as? String {
            println("\(spokenReply)")
        }
    }
})

      

+5


source


From Apple Dev Forums

This is the same push microphone on the iPhone keyboard and dictates.

Audio cuts down to apple and returns, and hopefully the text you spoke is returned as a string.

0


source







All Articles