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



我正在尝试打开whatsapp对话/聊天的特定联系人。而不是打开所需的聊天,它只打开应用程序。不知道怎么了:

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

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

有什么建议吗?

像这样更新你的URL:

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

试试这个,检查UIApplication和打开URL。

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

最新更新