To share both a link and photos simultaneously using FBSDKShareKit, you should use ShareLinkContent instead of SharePhotoContent. ShareLinkContent allows you to specify both a URL and photos to share.
Here's how you can modify your code to achieve this:
let content = ShareLinkContent()
content.contentURL = url
content.hashtag = Hashtag("#Hapufood")
content.imageURL = imageURL // Specify the URL of the image you want to share
// Display the share dialog
let dialog = ShareDialog(viewController: UIApplication.shared.keyWindow?.rootViewController, content: content, delegate: nil)
dialog.show()
In this code snippet, imageURL represents the URL of the image you want to share along with the link. You need to provide the URL of the image you want to share alongside the contentURL.
Make sure you have the appropriate permissions configured in your Facebook app settings to share links with photos. Additionally, ensure that the image you're trying to share is accessible and properly formatted for sharing on Facebook.
for multiple photos can you please try the below changes
// Assuming `sharePhotos` is an array of `UIImage` objects
let photoContent = SharePhotoContent()
photoContent.photos = sharePhotos.map { SharePhoto(image: $0, userGenerated: true) }
let linkContent = ShareLinkContent()
linkContent.contentURL = url
linkContent.hashtag = Hashtag("#Hapufood")
let content = ShareMediaContent()
content.media = [photoContent, linkContent]
// Display the share dialog
let dialog = ShareDialog(viewController: UIApplication.shared.keyWindow?.rootViewController, content: content, delegate: nil)
dialog.show()