如何在Facebook和Twitter上使用SLComposeViewController在同一个专辑中发布多个图像

时间:2016-02-03 07:32:39

标签: ios objective-c xcode facebook twitter

我是iOS / Objective-c的新手。我正在开发一个可以在Facebook和Twitter上共享多个图像的应用程序。我找到了代码但是当我在Facebook上使用该代码/代码时,所有图像都作为单独的帖子发布。

SLComposeViewController *composeViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
if (composeViewController)
    {
        for (int i=0; i<images.count; i++)
        {
            [composeViewController addImage:[images objectAtIndex:i]];
        }

        [composeViewController setCompletionHandler:^(SLComposeViewControllerResult result)
         {
             if (result == SLComposeViewControllerResultDone)
             {
                 //NSLog(@"Posted");
                 UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Successful" message:@"Image successfully posted." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
                 [alert show];
             }
             else if (result == SLComposeViewControllerResultCancelled)
             {
                 //NSLog(@"Post Cancelled");
             }
             else
             {
                 //NSLog(@"Post Failed");
             }
         }];

        [self presentViewController:composeViewController animated:YES completion:nil];
    }

所以我想知道如何发布多张图片,是否可以在一条推文或一张专辑中发布多张图片? 谢谢你提前。

1 个答案:

答案 0 :(得分:2)

不能使用 SLComposeViewController 使用 FBRequestConnection 要好得多。