Faisal Javaid
Faisal Javaid

Reputation: 129

is there a way to share a link on facebook messenger using facebook SDK

I am using facebook SDK for iOS and actually to share link on facebook messenger but can not find sufficient help, I am able to share the image by downloading the image and then attaching the downloaded image but it takes too much time to first download image and then attach. Now all I want is to share a simple link to facebook messenger.

Upvotes: 1

Views: 1382

Answers (1)

Rohit Pradhan
Rohit Pradhan

Reputation: 3875

This is what you can use where there is no need to download image, you can set the image Url it will be downloaded on facebook App once shared

FBSDKShareLinkContent *shareContent = [[FBSDKShareLinkContent alloc] init];
[shareContent setContentTitle:@"Title"];
[shareContent setImageURL:[NSURL URLWithString:someImageUrl]];
[shareContent setContentURL:[NSURL URLWithString:someURl]];

FBSDKMessageDialog *messageDialog = [[FBSDKMessageDialog alloc] init];
messageDialog.delegate = self;
[messageDialog setShareContent:shareContent];

if ([messageDialog canShow]) {
    [messageDialog show];
} else {
    // Messenger isn't installed. Redirect the person to the App Store.
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:kFacebookMessengerAppiTunesUrl]];
}

Upvotes: 4

Related Questions