使用iOS SocialFramework在Facebook上共享时,SLComposeViewControllerResult不正确

时间:2015-12-01 15:59:09

标签: ios ios9 slcomposeviewcontroller ios9.1

我正在使用Social框架从我的iOS应用程序共享并在iOS9上测试我的iOS应用程序。当我点击分享按钮时,它会打开本机Facebook应用程序ViewController,如下图所示。

enter image description here

问题是,无论用户点击帖子还是回击按钮,它仍会返回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];

0 个答案:

没有答案