从iOS应用程序发送消息到FB Messenger应用程序

问题描述:

我需要从我的应用程序发送一个预先填写的消息到fb Messenger应用程序。我遵循了 SO Link 的帖子。自定义网址只是打开了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];
}