Ios 使用Swift的聊天机器人中的IBM Watson超链接

Ios 使用Swift的聊天机器人中的IBM Watson超链接,ios,swift,ibm-watson,Ios,Swift,Ibm Watson,我想在IBM watson Chatbot中创建超链接,但我找不到解决方案。请在我获取计划文本时帮助我。我的代码如下: let text:String = "<a href=" + "https:IBMWatson.com" + ">" + IBMWATSON + "</a>" let data = text.data(using: String.Encoding.unicode)! // mind "!" let a

我想在IBM watson Chatbot中创建超链接,但我找不到解决方案。请在我获取计划文本时帮助我。我的代码如下:

   let text:String = "<a href=" + "https:IBMWatson.com" + ">" + IBMWATSON + "</a>"
            let data = text.data(using: String.Encoding.unicode)! // mind "!"
            let attrStr = try? NSAttributedString( // do catch
                data: data,
                options: [NSAttributedString.DocumentReadingOptionKey.documentType: NSAttributedString.DocumentType.html],
                documentAttributes: nil)

            let message = JSQMessage(
                senderId: ChatBotUser.Server.rawValue,
                senderDisplayName: ChatBotUser.getName(ChatBotUser.Server),
                date: date,
                text : attrStr.String
            )
            if let message = message {
                self.messages.append(message)
                self.finishSendingMessage(animated: true)
            }
let text:String=“”
让data=text.data(使用:String.Encoding.unicode)!//注意
让我们试试?NSAttributedString(//do catch
数据:数据,
选项:[NSAttributedString.DocumentReadingOptionKey.documentType:NSAttributedString.documentType.html],
文件属性:无)
let message=JSQMessage(
senderId:ChatBotUser.Server.rawValue,
senderDisplayName:ChatBotUser.getName(ChatBotUser.Server),
日期:日期:,
文本:attrStr.String
)
如果let message=message{
self.messages.append(消息)
self.finishSendingMessage(动画:true)
}

你的问题实际上与沃森有关吗?是的!!它通过聊天机器人中的文本与超链接相关