问题
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: http://imgur.com/mZ483i9 (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.
回答1:
Due to Facebook rules you can`t set non user generated text.
来源:https://stackoverflow.com/questions/30802684/fbsdksharephoto-not-sharing-link-alongside-photo-using-swift