Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

450
Views
How to share image with text in Facebook SDK in swift

I want to share a post on facebook with Image and text. I am using Facebook SDK and I am able to share Image, Now I want to share text with this image. How I can?

Here is the source code of sharing the image,

 let photo:FBSDKSharePhoto = FBSDKSharePhoto()

    var message:String?

    let imageName:String = "Star.png"
    photo.image = UIImage(named: imageName)
    photo.isUserGenerated = true

    let content = FBSDKSharePhotoContent()
    content.photos = [photo];


    let dialog = FBSDKShareDialog()
    dialog.fromViewController = self
    dialog.shareContent = content
    dialog.mode = .native
    dialog.show()
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Due to the abuse from some applications, Facebook has explicitly disabled the pre-fill option for the text by simply ignoring it.

"You must not pre-fill any of the fields associated with the following products, unless the user manually generated the content earlier in the workflow: Stream stories (user_message parameter for Facebook.streamPublish and FB.Connect.streamPublish, and message parameter for stream.publish), Photos (caption), Videos (description), Notes (title and content), Links (comment), and Jabber/XMPP."

More info here.

over 4 years ago · Santiago Trujillo Report

0

Facebook wont allow user to add text with image.

Integrate facebookshare sdk

@IBAction func facebookBtn(sender: AnyObject) {
  let shareImage = SharePhoto()
  shareImage.image = imageView.image //Image from your imageview
  shareImage.isUserGenerated = true

  let content = SharePhotoContent()
  content.photos = [shareImage]

  let sharedDialoge = ShareDialog()
  sharedDialoge.shareContent = content

  sharedDialoge.fromViewController = self
  sharedDialoge.mode = .automatic


  if(sharedDialoge.canShow)
  {
    sharedDialoge.show()
  }
  else
  {
    print("Install Facebook client app to share image")
  }
}
over 4 years ago · Santiago Trujillo Report

0

Try this :

 let sharePhoto = FBSDKSharePhoto()
photo.image = photo
photo.caption = "you title"

let content = FBSDKShareMediaContent()
content.media = [photo];
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!