Can't share text to fb messenger using UIActiv

2019-07-15 05:54发布

I can share text to whatsapp/message app using

NSString* text=@"I am sharing this text";
NSArray* sharedArray=@[text];
UIActivityViewController * activityVC=[[UIActivityViewController alloc]initWithActivityItems:sharedArray applicationActivities:nil];
dispatch_async(dispatch_get_main_queue(), ^{
    // code here
    [self presentViewController:activityVC animated:YES completion:nil];//:activityVC animated:YES];

});

BUt the facebook messenger option is missing when I use this piece of code.

I have to add NSURL to the array, to make the facebook messenger option visible in the UIActivityController view:

NSString* text=@"I am sharing this text";
NSURL *myWebsite = [NSURL URLWithString:@"http://www.google.com"];
NSArray* sharedArray=@[text,myWebsite];
UIActivityViewController * activityVC=[[UIActivityViewController alloc]initWithActivityItems:sharedArray applicationActivities:nil];
dispatch_async(dispatch_get_main_queue(), ^{
    // code here
    [self presentViewController:activityVC animated:YES completion:nil];//:activityVC animated:YES];

});

But the issue is, the text is not shared in the facebook messenger, only the link gets shared to fb-messenger.

Is there a way to share text to fb-messenger from our app ?

1条回答
孤傲高冷的网名
2楼-- · 2019-07-15 06:39

According to Facebook's Platform Policy you unfortunately can no longer provide pre-fill text for sharing. This is why sharing with text silently fails. Who knows, if enough people complain they might change this, but I wouldn't hold your breath!

查看更多
登录 后发表回答