问题
I'm trying to share an image and a text with the new SDK 4.0 of Facebook but I'm unable to do it. To share an image I have this code:
FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
photo.image = imageFinal;
photo.userGenerated = YES;
FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
content.photos = @[photo];
[FBSDKShareDialog showFromViewController:self withContent:content delegate:self];
This works fine, but I don't find the method to share with this image a text. I have found how to share a text with FBSDKShareLinkContent, but it doesn't serve to share an image too.
Can anyone help me?
Thanks for all.
回答1:
This is because Facebook allows the developer to pick what image to share but the Facebook user is the only one allowed to set the description of that picture in the share view controller.
回答2:
there is a game on IOS called "whatif" when you click on share button in the game, a pop-up shows up to collect the user's description for the post that is about to be shared.
so i think there is a way or another to achieve such behavior.
follow this link below: https://github.com/facebook/facebook-ios-sdk
inside the Scrumptious sample project you will find that you can allow the user to enter description for a post with image, then you can share the post along with the description the user has provided.
pretty much like the way you want.
回答3:
If you want to share an image and a text together, you can create a custom story from your app's settings, and share it as an open graph story. Here's the documentation.
回答4:
As per facebook documentation - We can send only image or text separately. Not possible to send image and text at a time.
来源:https://stackoverflow.com/questions/29924085/share-image-ant-text-facebook-sdk-4-0-ios