Extending Facebook, sharing images and links

It seems like Facebook recently broke (or deliberately removed?) The ability to share images and links in a single post via its resource extension, trying to share an image with a link now only results in images being posted. Link-only sharing works and generates an image preview message on the linked page.

Previously, you could share images and links in one post, is there a way to restore this functionality after Facebook v29 app?

Here's a quick sample that illustrates what used to work, but now only splits the image.

NSArray *activityItems = @[
                           [NSURL URLWithString:@"http://stackoverflow.com/"], 
                           [UIImage imageNamed:@"shareImage"]
                          ];

UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
[self presentViewController:activityViewController animated:YES completion:nil];

      

Update - Facebook recognized this as a bug

+3


source to share


1 answer


According to the latest SDKs in v4.0.1. we can confidently share image and links, but not both at the same time.


Sharing url and url url (not image): -

The FBSDKShareLinkContent model includes the attributes displayed in the message:

contentURL - link to share

contentTitle - represents the title of the content in the link



imageURL - The URL of the thumbnail displayed in the message

contentDescription - content, usually 2-4 sentences

FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:@"http://google.com"];
content.imageURL=[NSURL URLWithString:@"http://nasa.org/a.jpg"];
content.contentTitle=@"Facebook Share";
content.contentDescription=@"Lets see, How my share works guyz..";
[FBSDKShareDialog shareFromViewController:self
                              withContent:content
                                 delegate:nil];

      


Image only exchange:

FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
  photo.image = self.imgView.image;// you can edit it by your choice
  photo.userGenerated = YES;
  FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
  content.photos = @[photo];

      

+3


source







All Articles