本文介绍了从iOS应用程序发送消息到FB Messenger应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从我的应用程序发送一个预先填写的消息到fb Messenger应用程序。我遵循了的帖子。自定义网址只是打开了fb信使应用程序,但显示没有更改。
I need to send a pre-filled message from my app to the fb messenger app. I followed the post SO Link. The custom URL just opens the fb messenger app but shows no change.
以下是我尝试的代码:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"fb-messenger://contacts"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"fb-messenger://share"]];
上面的代码只是打开了fb messenger应用,它不会导航到联系人页面或撰写屏幕。
The above code just opens the fb messenger app, it does not navigate to contacts page or the compose screen.
有人遇到同样的情况吗?有没有人知道要从应用发送文本的代码?
Has anybody faced the same situation? Does anybody know the code for sending the text I want to share from the app? Examples would be appreciated.
推荐答案
使用以下代码转载,将适用于您
Go with following code its will works for you
NSURL *fbURL = [NSURL URLWithString:@"fb-messenger://user-thread/USER-ID/"];
if ([[UIApplication sharedApplication] canOpenURL: fbURL]) {
[[UIApplication sharedApplication] openURL: fbURL];
}
这篇关于从iOS应用程序发送消息到FB Messenger应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!