问题
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.
回答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];
}
来源:https://stackoverflow.com/questions/26874818/sending-message-from-ios-application-to-fb-messenger-app