问题
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