Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending image + url in UIActivityViewController in Facebook Messenger

Tags:

using a simple UIActivityViewController

-(void)share{      NSString *textToShare = _mytext; NSURL *url = [NSURL URLWithString:@"http://www.google.com"];     UIImage *imageToShare = _myimage;     NSArray *activityItems = @[textToShare, url,  imageToShare];     UIActivityViewController *activityVC =     [[UIActivityViewController alloc] initWithActivityItems:activityItems                                       applicationActivities:nil];      [self presentViewController:activityVC animated:YES completion:nil]; } 

I want to share a text, url and image where appropriate.

So if the user chooses mail, everything appears. Etc with the rest of the apps (pinterest, facebook, twitter)

On Facebook Messenger - If a url and an image is shared, the share screen crashes. Is this a known issue (can't send image with a url)?

like image 927
Nick Ginanto Avatar asked May 18 '15 11:05

Nick Ginanto


People also ask

How do you add a caption to a photo on messenger?

Open any conversation, then tap the following options at the bottom next to the text box. If you don't see these options, tap next to the text box first. Take and send new photos or videos.


1 Answers

* EDIT: Updated to the latest SDK

FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init]; content.contentTitle = @"Your title"; content.contentDescription = @"Some description text maybe..."; content.contentURL = [NSURL URLWithString:@"http://yourlink.com"]; content.imageURL = [NSURL URLWithString:@"http://yourlink.com/theImage.png"];  [FBSDKMessageDialog showWithContent:content delegate:self];   // Delegate - (void)sharer: (id<FBSDKSharing>)sharer didCompleteWithResults: (NSDictionary *)results  {     BOOL complete = [[results valueForKeyPath:@"didComplete"] boolValue];     NSString *completionGesture = [results valueForKeyPath:@"completionGesture"];     if (completionGesture && [completionGesture isEqualToString:@"cancel"]) {         // action was canceled by the user     }      if (complete) {         // the message/link/image was sent     } }  - (void) sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error {     // handle error... } 

You can give it a try :)

like image 140
Виктор Иванов Avatar answered Sep 22 '22 22:09

Виктор Иванов