Open WhatsApp conversation using Abid doesn't work

二次信任 提交于 2019-12-11 09:26:34

问题


I'm trying to open whatsapp conversation/chat for particular contact. Instead of opening the desired chat it only opens the app. No idea whats wrong :

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

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

Any suggestions?


回答1:


Update your URL like this:

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

Source from HERE.




回答2:


Try this and check if the UIApplication and open the URL.

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


来源:https://stackoverflow.com/questions/32788744/open-whatsapp-conversation-using-abid-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!