0

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.

Below is the code that I have tried:

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"fb-messenger://contacts"]];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"fb-messenger://share"]];

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.

Community
  • 1
  • 1
J J
  • 134
  • 1
  • 1
  • 11
  • Side note: Facebook doesn't like when your app auto-populates post text. – Ian MacDonald Nov 11 '14 at 21:25
  • Facebook does more then not like it. It is not allowed according to Facebook Platform Policy that you can read at https://developers.facebook.com/policy . Not that you can do it but if you could we would ban your app anyway. – WizKid Nov 11 '14 at 21:30

1 Answers1

1

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];
}
Pinank Lakhani
  • 1,109
  • 2
  • 11
  • 31