我正在使用Social框架从我的iOS应用程序共享并在iOS9上测试我的iOS应用程序。当我点击分享按钮时,它会打开本机Facebook应用程序ViewController,如下图所示。
问题是,无论用户点击帖子还是回击按钮,它仍会返回SLComposeViewControllerResultDone结果。这是我的SLComposeViewController的完成处理程序。这是代码:
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];