简体   繁体   English

未在手机上安装Facebook应用程序时,如何在iOS应用程序中将照片共享到Facebook?

[英]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.

相关问题 在没有安装Facebook App的情况下,FBSDKShareDialog不会共享照片 - FBSDKShareDialog doesn't share Photo without Facebook App installed, IOS iOS Facebook SDK分享照片并从Facebook应用注销后 - iOS Facebook SDK share photo and after logout from Facebook app 安装Facebook应用程序时,我无法将我的iOS应用程序内容共享到Facebook - I can't share a content from my iOS app to the Facebook when Facebook app is installed 如何在不使用本机ios应用程序的FBSDKShareDialog的情况下在Facebook墙上共享照片或链接 - how to share a Photo Or link on facebook wall without using FBSDKShareDialog from native ios app 安装Facebook应用程序的Facebook SDK iOS登录 - Facebook SDK iOS login with Facebook app installed 如果安装了Facebook应用,iOS Facebook授权失败 - iOS Facebook Authorize failing if Facebook app is installed 如果尚未安装iOS应用的Facebook深层链接 - Facebook deep linking for an iOS App when the app is not installed yet Facebook在Z1BDF60599191919191919191919191CBDF8508204C4EBZ中通过Z26CAE7718C3218018019D6D6D4019D4019D4019D4019D4019D4019D4019D4019D4019D4019D19D4019D4019D19D19D19D19D20DB10C4NEC4EBZ登录失败 - Facebook sign-in in iOS fails when sign in through facebook app, it's working if the facebook app not installed in the device 如何通过iOS应用在Facebook上共享应用信息? - How to share app info on facebook through iOS app? 未配置应用时在Facebook上分享 - Share on facebook when app is not configured
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM