Share multiple photos in a single Facebook post using UIActivityViewController

Below this code I am sharing 1 text and 2 photos using the UIActivityViewController. Then I select Facebook for my sharing destination, and it is divided into 2 divided posts in the feed for each photo, but I want to share it in one message with 1 text and 2 photos. How can i achieve this? I did a lot of searching here and did not find the right answer. It seems to me that Facebook has no clear way to do this, so it seems that such a problem could lie on their side.

activityItems = @[self.textDetail.text, self.imageFileView1.image, self.imageFileView2.image]; UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil]; 
+1
source share
2 answers

The problem was solved either by the new iOS ver or Facebook by a new way of processing activity elements. In any case, it works as I expect.

+1
source

Try the following:

 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]; 
+1
source

Source: https://habr.com/ru/post/1502768/


All Articles