如何从iOS应用发出WhatsApp呼叫? [英] How can I place a WhatsApp call from an iOS app?
问题描述
我希望能够使用iOS应用中的WhatsApp号码拨打电话。我该怎么办?
I would like to be able to place a call using a WhatsApp number from my iOS app. How can I do that?
推荐答案
您应该问WhatsApp怎么做。
解决方案在于URL架构: https://www.whatsapp.com / faq / de / iphone / 23559013
You should ask WhatsApp how to do so. The solution lies in URL Schema: https://www.whatsapp.com/faq/de/iphone/23559013
此处是从目标站点中从Objective-C复制的代码。我会在Swift中将其作为练习:
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];
}
为了确保这一点:他们不会让您发送邮件直接发送给某人,甚至更多:如果您之前未打开WhatsApp,他们将不允许您静默地向您发送消息。
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.
这篇关于如何从iOS应用发出WhatsApp呼叫?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!