How can I place a WhatsApp call from an iOS app?

 ̄綄美尐妖づ 提交于 2019-12-11 06:18:02

问题


I would like to be able to place a call using a WhatsApp number from my iOS app. How can I do that?


回答1:


You should ask WhatsApp how to do so. The solution lies in URL Schema: https://www.whatsapp.com/faq/de/iphone/23559013

Here the code copied from their site, in Objective-C. I'll keep it as an exercise to do so in Swift:

NSURL *whatsappURL = [NSURL URLWithString:@"whatsapp://send?text=Hello%2C%20World!"];
if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
    [[UIApplication sharedApplication] openURL: whatsappURL];
}

And just to make it sure: They won't let you send messages directly to someone, and even more: They won't let you send you messages silently, without WhatsApp being opened before.



来源:https://stackoverflow.com/questions/41999491/how-can-i-place-a-whatsapp-call-from-an-ios-app

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