使用Abid打开WhatsApp对话并不起作用

时间:2015-09-25 18:47:34

标签: ios swift whatsapp url-scheme

我试图打开特定联系人的whatsapp对话/聊天。 它不会打开所需的聊天,而只会打开应用程序。 不知道什么是错的:

 let URLString  = "whatsapp://send?abid=\(ID);text=lOL;"
        UIApplication.sharedApplication().openURL(NSURL(string: URLString)!)

URLString值:whatsapp://send?abid=414;text=lOL

有什么建议吗?

2 个答案:

答案 0 :(得分:3)

像这样更新你的URL

whatsapp://send?abid=\(ID)&text=lOL

来自HERE的来源。

答案 1 :(得分:1)

尝试此操作并检查是否UIApplication并打开网址。

let whatsAppURL: NSURL = NSURL(string: "whatsapp://send?abid=\(ID)&text=lOL")
if UIApplication.sharedApplication().canOpenURL(whatsAppURL){
    UIApplication.sharedApplication().openURL(whatsAppURL)
}
相关问题