1

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];
SanitLee
  • 1,253
  • 1
  • 12
  • 29
  • It's been posted for so long with no one giving it a shot :( – SanitLee Jan 14 '15 at 10:07
  • hooked up with [this question](http://stackoverflow.com/questions/15419211/getting-all-photos-included-in-a-single-facebook-feed-post-with-either-graph-api) – SanitLee Feb 05 '15 at 08:11

2 Answers2

1

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];
Pang
  • 9,564
  • 146
  • 81
  • 122
Avijit Nagare
  • 8,482
  • 7
  • 39
  • 68
  • Thank you for your answer. Thought I just found that Facebook may have sorted out this issue with its new ver app. Now it works the way I expect with my original code :) – SanitLee Dec 23 '15 at 02:17
  • Perhaps it's down to the new iOS ver. Not sure. – SanitLee Dec 23 '15 at 03:46
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.

SanitLee
  • 1,253
  • 1
  • 12
  • 29