Share multiple photos on the same post in Facebook using UIActivityViewController

孤人 提交于 2019-12-08 04:14:11

问题


Below given code, I'm sharing 1 text and 2 photos using UIActivityViewController. Then I choose Facebook for my sharing destination and it's shared on 2 separated posts on the feed for each photo but what I want is to share it in one single post with 1 text and 2 photos. How can I achieve this? I have done lot of search on here and found no proper answer. It seems to me that Facebook may have no clear way to do this, so it's like such an issue may lie on their side.

activityItems = @[self.textDetail.text, self.imageFileView1.image, self.imageFileView2.image];

UIActivityViewController *activityController =
[[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];

回答1:


The issue was solved by either new iOS ver or Facebook's new way of handling activity items. Anyway it works as I expect now.




回答2:


Try this:

NSString *message = @"msg To post";   
NSMutableArray *postsImages=[[NSMutableArray alloc] init];
[postsImages addObject:message];
for (UIImage *img in collectionImageArray) {
    [postsImages addObject:img];
}

UIActivityViewController *activityVC = [[UIActivityViewController alloc]
                                        initWithActivityItems:postsImages
                                        applicationActivities:nil];

[activityVC setCompletionWithItemsHandler:^(NSString *activityType, BOOL completed,  NSArray *returnedItems, NSError *activityError) {

    if([activityType isEqualToString:UIActivityTypePostToTwitter]){
        //twitter selected
    }
}];

[self presentViewController:activityVC animated:YES completion:nil];


来源:https://stackoverflow.com/questions/27586505/share-multiple-photos-on-the-same-post-in-facebook-using-uiactivityviewcontrolle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!