Roi Mulia
Roi Mulia

Reputation: 5896

Open WhatsApp conversation using Abid doesn't work

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?

Upvotes: 1

Views: 2383

Answers (2)

Dharmesh Kheni
Dharmesh Kheni

Reputation: 71854

Update your URL like this:

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

Source from HERE.

Upvotes: 3

Brian Nezhad
Brian Nezhad

Reputation: 6268

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)
}

Upvotes: 1

Related Questions