FBSDKSharePhoto not sharing link alongside photo using Swift
Asked Answered
S

1

9

When I try to share a link along with a picture, at the same time, via FBSDKSharePhoto, only the photo gets shared. No link appears.

Here is the code I use:

let photo : FBSDKSharePhoto = FBSDKSharePhoto()
photo.image = self.scaledImage
photo.userGenerated = true

let content : FBSDKSharePhotoContent = FBSDKSharePhotoContent()
content.contentURL = NSURL(string: self.short_string)
content.photos = [photo]

let button : FBSDKShareButton = FBSDKShareButton()
button.shareContent = content

And a picture of the resulting dialog when I push the button: https://i.sstatic.net/eUtyu.jpg (also attached)

You can see the picture gets attached to the post, but there is no link. I know all of the URL/Photo variables work fine because they are used elsewhere.

If I switch the sharing method to FBSDKShareLinkContent then content.contentURL works fine, but I cannot post the picture this way because the picture is not hosted on the web, which is why I am using FBSDKSharePhotoContent. (The picture is taken within the app.)

let content : FBSDKShareLinkContent = FBSDKShareLinkContent()
content.contentURL = NSURL(string: self.short_string)
content.contentTitle = self.title_text
content.contentDescription = self.desc_text
content.imageURL = NSURL(string: "http://randomimage.jpg/")

let button : FBSDKShareButton = FBSDKShareButton()
button.shareContent = content

So I know my link is structured properly according to the contentURL protocol, and FBSDKSharePhotoContent conforms to the same functions as FBSDKShareLinkContent. No clue why it won't work.

Sartin answered 12/6, 2015 at 12:6 Comment(0)
D
1

Due to Facebook rules you can`t set non user generated text.

Detritus answered 3/12, 2016 at 17:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.