iOS 9下编程向WhatsApp联系人ID发送消息的方法不再可用

5
我在一个简单的应用程序中尝试了以下内容,但它不再起作用:-
[[UIApplication sharedApplication] openURL: [NSURL URLWithString:[NSString stringWithFormat:@"whatsapp://send?abid=%d&text=%@", abid, @""]]];

WhatsApp在最新版本中是否取消了这个功能?

aide参数已经消失了(因为它与AdresseBook.framework有关,现在可能应该使用Contacts.framework?)http://web.archive.org/web/20150329073451/https://www.whatsapp.com/faq/iphone/23559013与https://www.whatsapp.com/faq/iphone/23559013不同。 - Larme
嗨,谢谢,嗯,很有趣。我明白你的意思,如果是这样的话,我不确定参数会是什么,我会进一步调查,但目前我正在寻找答案。谢谢。 - Wael
WhatsApp本可以将abid重命名为其他名称! - Wael
你应该使用新的官方 API,我在这里提到了它 https://dev59.com/zpTfa4cB1Zd3GeqPLxZJ#45227158 - DavidTaubmann
2个回答

2
在iOS 9中,需要调用LSApplicationQueriesSchemes,确保您已在.plist文件中添加了以下信息:
<key>LSApplicationQueriesSchemes</key>
 <array>
  <string>whatsapp</string>
 </array>

请检查这是否适用于您


谢谢,但这只允许启用WhatsApp的URL方案,这是必需的,但之后的问题是关于传递ABID参数,它曾经有效,如果您使用有效的联系人ID传递abid参数,它应该打开与该特定联系人的对话,准备发送新消息,但似乎WhatsApp删除了ABID参数!或者重命名了它!请仔细查看我上面的代码行。谢谢。 - Wael

-1

尝试使用以下代码适用于iOS 9:

NSURL *whatsappURL = [NSURL URLWithString:@"whatsapp://send?text=Hello%2C%20World!"];

    if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
        [[UIApplication sharedApplication] openURL: whatsappURL];
    }

我无法回应这个答案。 - Wael

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接