[英]How to share photo to Facebook within iOS app, when Facebook app is not installed on the phone?
Im using FBSDKShareKit
(4.22.1), i'm trying to share photo with the following code: 我正在使用
FBSDKShareKit
(4.22.1),我正在尝试使用以下代码共享照片:
let photo = FBSDKSharePhoto()
photo1.imageURL = URL(string: "sample url")
photo.isUserGenerated = false
let photoContent = FBSDKSharePhotoContent()
photoContent.photos = [photo]
FBSDKShareDialog.show(from: self, with: photoContent, delegate: nil)
but it only works when the native Facebook app is installed on the phone. 但它仅在手机上安装了本地Facebook应用程序时有效。 I also tried to show the content with Share Button instead of Share Dialog like:
我还尝试使用“ 共享按钮”而不是“ 共享对话框”显示内容,例如:
var shareButton = FBSDKShareButton()
shareButton.shareContent = photoContent
shareButton.center = self.view.center
self.view.addSubview(shareButton)
it didn't work, if app was not installed either. 如果也未安装应用程序,则此操作无效。
i want the FBSDK i used in my app, opens Safari when Facebook app is not installed, it opens safari by default for FBSDKShareLinkContent
, but not working for FBSDKSharePhotoContent
. 我想要我在应用程序中使用的FBSDK,在未安装Facebook应用程序时打开Safari,默认情况下会为
FBSDKShareLinkContent
打开safari,但对FBSDKSharePhotoContent
。 does anyone know what is the problem? 有谁知道这是什么问题?
I have implemented another way to share photos using Graph API . 我已经实现了另一种使用Graph API共享照片的方法。 It was very helpful.
这非常有帮助。 Here is a link .
这是一个链接 。 Just what you need is to take the permissions from the user to publish_actions before posting.
您只需要在发布前从用户获得publish_actions的权限即可。 Also there is no native facebook app installed.
也没有安装本地Facebook应用程序。 Just got logged in through Browser.
刚通过浏览器登录。 I hope this is helpful to you.
希望对您有帮助。
Well, I found the answer in Facebook developer website , which is: 好吧,我在Facebook开发者网站上找到了答案:
Photos
相片
People can share photos from your app to Facebook with the Share Dialog or with a custom interface:
人们可以使用“共享对话框”或自定义界面将您的应用程序中的照片共享到Facebook:
Photos must be less than 12MB in size
照片大小必须小于12MB
People need the native Facebook for iOS app installed, version 7.0 or higher
人们需要安装适用于iOS应用的Facebook版本7.0或更高版本
you can also ask for "publish_actions", you need to login twice, first with readPermission for email, then when user wants to share a post loginWithPublishPermission for "publish_actions". 您还可以要求输入“ publish_actions”,您需要登录两次,首先使用readPermission来发送电子邮件,然后在用户希望为“ publish_actions”共享帖子loginWithPublishPermission时使用。 the point is that you have to add "publish_actions" first of all in your Facebook developer account.
关键是您必须首先在您的Facebook开发人员帐户中添加“ publish_actions”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.