我想presentTextInputControllerWithSuggestions在一个WatchKit应用程序中使用.我不确定我哪里出错了.
presentTextInputControllerWithSuggestions(["Hello", "Hey"], completion: {
(myString) -> Void in
println(myString)
})
Run Code Online (Sandbox Code Playgroud)
WatchKit
已知的问题
iOS模拟器中目前不支持presentTextInputControllerWithSuggestions:completion:WKInterfaceController方法.
您可以尝试点击建议.它应该与口述完全相同.请注意,完成返回一个数组而不是字符串.你应该这样做
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)")
}
}
})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2965 次 |
| 最近记录: |