Can't share text to fb messenger using UIActivityViewController

这一生的挚爱 提交于 2019-12-12 20:09:14

问题


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:


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!



来源:https://stackoverflow.com/questions/36070512/cant-share-text-to-fb-messenger-using-uiactivityviewcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!