我看了FacebookSDK
:https://developers.facebook.com/docs/sharing/ios/send-button,我只看到要上传到Facebook的imageURL。
NSURL *contentURL = [[NSURL alloc] initWithString:
@"http://en.wikipedia.org/wiki/Facebook"];
NSURL *imageURL =
[NSURL URLWithString:@"http://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Facebook_Headquarters_Menlo_Park.jpg/2880px-Facebook_Headquarters_Menlo_Park.jpg"];
_sendButton.shareContent = [[FBSDKShareLinkContent alloc]
initWithContentURL: contentURL
contentTitle: @"My Share Title"
contentDescription: @"Lorem ipsum dolor sit amet."
imageURL: imageURL
peopleIDs: nil
placeID: nil
ref: nil
];
我尝试了shareButton
:
let shareButton = FBSDKShareButton()
shareButton.center = view.center
let content = FBSDKShareLinkContent()
content.contentTitle = caption
content.imageURL = NSURL(string: "https://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Facebook_Headquarters_Menlo_Park.jpg/2880px-Facebook_Headquarters_Menlo_Park.jpg")
shareButton.shareContent = content
view.addSubview(shareButton)
我可以轻松地将其上传到我的时间线。
但我只想发送从PhotoLibrary获取的图像上传到Facebook。是可能的,因为当我尝试content.image
时(我没有暗示这个)
答案 0 :(得分:1)
您正在使用FBSDKShareLinkContent,它只允许您共享链接(和img urls)。如果要将照片分享到Facebook,则需要使用FBSDKSharePhotoContent或FBSDKShareMediaContent类,您可以在其中添加UIImage对象数组。
请参阅SDK随附的目录示例应用,了解如何在实践中使用此功能。