【发布时间】:2018-01-12 09:39:29
【问题描述】:
我将根据Build a home assistant mobile application with Watson and IoT Platform services更新我的自定义示例
在这段代码中,我得到消息:
无法将“字符串”类型的值转换为预期的参数类型“输入数据”?
如何解决这个问题? 在documentation of developer cloud/conversation/api里面我可以找到InputData的定义,但是NO示例如何在Swift iOS中实现呢?
// Based on API Changes
// ====================
// Incorrect argument label in call (have 'text:context:', expected 'input:context:')
// Cannot convert value of type 'String' to expected argument type 'InputData?'
let request = MessageRequest(input: text, context: self.context)
self.conversation?.message(workspaceID: Credentials.ConversationWorkspaceID,
request: request,
failure: failure) {
response in
print(response.output.text)
self.didReceiveConversationResponse(response.output.text)
self.context = response.context
// issue command based on intents and entities
// Additional Properties:
// response.context.json -> response.context.additionalProperties
print("appl_action: \(response.context.additionalProperties["appl_action"])")
self.issueCommand(intents: response.intents, entities: response.entities)
}
【问题讨论】:
标签: ios swift watson-conversation