1
votes

I'm working with deep link in iOS. I am going to share a link in Facebook using `FBSDKShareLinkContent. I have created deep linking URL in Facebook like https://fb.me/****************.

I have already done AppInviteContent and it works good like this:

 

let content : FBSDKAppInviteContent = FBSDKAppInviteContent()
content.appLinkURL = NSURL(string: "https://fb.me/****************")!
content.appInvitePreviewImageURL = NSURL(string: "http://***.***.***.***/shareImage.png" as String)!
FBSDKAppInviteDialog.showWithContent(content, delegate: self)

Now, I am sharing link in Facebook like this:

let shareLinkContent : FBSDKShareLinkContent = FBSDKShareLinkContent()
shareLinkContent.contentURL = NSURL(string: "https://example.com/a2d69835ae")!
shareLinkContent.contentTitle = "App_Name"
shareLinkContent.contentDescription = "Description"

let dialog : FBSDKShareDialog = FBSDKShareDialog()
dialog.fromViewController = self
dialog.delegate = self
dialog.shareContent = shareLinkContent
dialog.mode = FBSDKShareDialogMode.Web
dialog.show()

How to set deep link URL (e.g. https://fb.me/****************) in this shareLinkContent.

2
You want show the Facebook ShareDialog inside your application ?Abilash Balasubramanian
@AbilashBNair - Yes Nair.Sabs
What is your FBSDK pod versions?Abilash Balasubramanian
@AbilashBNair - FBSDK pod version is 4.12.0Sabs

2 Answers

2
votes

A very apt idea is to use Branch framework for the deep linking feature. You can get to know how to use this framework from here https://branch.io/

It can be used to share your app contents to any of the social networking sites. it has the feature on universal linking and deep linking.

0
votes

Remove this below code, this have been modified in latest pod version.

let dialog : FBSDKShareDialog = FBSDKShareDialog()
dialog.fromViewController = self
dialog.delegate = self
dialog.shareContent = shareLinkContent
dialog.mode = FBSDKShareDialogMode.Web
dialog.show()

Add this code will show Facebook Share dialog:

 FBSDKShareDialog.show(from: self, with: shareLinkContent, delegate: self)

This will fix your FBSDK share issue.

For APP invite try some thing like this:

{
    let content : FBSDKAppInviteContent = FBSDKAppInviteContent()
        content.appLinkURL = NSURL(string: "https://fb.me/****************")!
        content.appInvitePreviewImageURL = NSURL(string: "http://***.***.***.***/shareImage.png" as String)!
        FBSDKAppInviteDialog.show(from: self, with: content, delegate: self)
}