FBSDKSharePhoto无法使用Swift分享照片旁边的链接 [英] FBSDKSharePhoto not sharing link alongside photo using Swift

查看:67
本文介绍了FBSDKSharePhoto无法使用Swift分享照片旁边的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试与图片共享链接时,同时通过FBSDKSharePhoto,仅共享照片.没有链接出现.

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.

这是我使用的代码:

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

以及当我按下按钮时出现的对话框的图片: http://imgur.com/mZ483i9 (另附)

And a picture of the resulting dialog when I push the button: http://imgur.com/mZ483i9 (also attached)

您可以看到图片附在帖子上,但是没有链接.我知道所有URL/Photo变量都可以正常工作,因为它们已在其他地方使用.

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.

如果将共享方法切换为FBSDKShareLinkContent,则content.contentURL可以正常工作,但是由于该图片未托管在网络上,因此无法以这种方式发布图片,这就是为什么我使用FBSDKSharePhotoContent的原因.(照片是在应用程序内拍摄的.)

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

因此,我知道我的链接是根据contentURL协议正确构造的,并且FBSDKSharePhotoContent符合与FBSDKShareLinkContent相同的功能.不知道为什么它不起作用.

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.

推荐答案

由于Facebook规则,您无法设置非用户生成的文本.

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

这篇关于FBSDKSharePhoto无法使用Swift分享照片旁边的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆