I want to share image,url and text to facebook and I am not able to make it work on iOS9.Here is my code.
-(IBAction)shareOnFacebook:(id)sender{
UIButton *btn = (UIButton *)sender;
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:SHARING_QUOTE_D(self.dish.name, self.dish.restaurant.name)];
[controller addURL:[NSURL URLWithString:SHARING_URL]];
[controller addImage:self.dishImageView.image];
[self presentViewController:controller animated:YES completion:Nil];
if ([controller respondsToSelector:@selector(popoverPresentationController)])
{
UIPopoverPresentationController *presentationController = [controller popoverPresentationController];
presentationController.sourceView = btn; // if button or change to self.view.
}
}else{
[[[UIAlertView alloc] initWithTitle:@"Error Message" message:@"Please log into your Facebook account to post" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil] show];
}
}