I am using a UIActivityViewController which provides some default text and a link. With all social mediums (sms, email, twitter) the default text and URL are shown. However, with FB while the URL image is shown, the default text is not showing (it is just blank). Below is the code:
NSString *shareStr = [NSString stringWithFormat:@""some text"];
NSURL *website = [NSURL URLWithString:@"website"];
NSArray *shareAray = @[shareStr,website];
[self viewWillDisappear:YES];
UIActivityViewController *activityController = [[UIActivityViewController alloc]initWithActivityItems:shareAray
applicationActivities:nil];
if([activityController respondsToSelector:@selector(popoverPresentationController)] )
activityController.popoverPresentationController.barButtonItem = self.shareButton;
[self presentViewController:activityController
animated:YES completion:nil];
[activityController setCompletionHandler:^(NSString *activityType, BOOL completed){
if (!activityType || UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
[self viewWillAppear:YES];
}
}];
Update:
As noted in what others said below, FB no longer allows pre-fill. Here is another link to a video that gives examples of what is allowed and what isn't: https://developers.facebook.com/docs/apps/review/prefill
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…