I am using Social framework for sharing from my iOS application and testing my iOS application on iOS9. When I click on share button it opens native facebook application ViewController as shown in following image.
The problem is that irrespective of user clicks post or hit back button it still return SLComposeViewControllerResultDone result. Here is my completion handler for SLComposeViewController. Here is code:
NSLog(@"%@Controller presenting",socialMediaSLType);//socialMediaSLType is SLServiceTypeFacebook
SLComposeViewController *controllerSLC = [SLComposeViewController composeViewControllerForServiceType:socialMediaSLType];
[controllerSLC setInitialText:@""];
[controllerSLC addURL:[NSURL URLWithString:link]];
[controllerSLC addImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@%@",BASEURL,image]]];
[controllerSLC setCompletionHandler:^(SLComposeViewControllerResult result){
switch (result) {
case SLComposeViewControllerResultCancelled:
NSLog(@"Post Canceled");
break;
case SLComposeViewControllerResultDone:
NSLog(@"Post Done");
break;
}
}];
[self presentViewController:controllerSLC animated:YES completion:nil];