Ios 在facebook后台共享带有标题的照片

Ios 在facebook后台共享带有标题的照片,ios,swift,facebook,facebook-graph-api,Ios,Swift,Facebook,Facebook Graph Api,我成功地在facebook上发布了一张图片,背景是下面的代码,但不知怎么的,我不知道如何添加标题。我看了官方文件,但还是找不到。请帮忙。提前谢谢 import UIKit import FBSDKLoginKit import FBSDKShareKit class ViewController: UIViewController, FBSDKLoginButtonDelegate, FBSDKSharingDelegate { override func viewDidLoad(

我成功地在facebook上发布了一张图片,背景是下面的代码,但不知怎么的,我不知道如何添加标题。我看了官方文件,但还是找不到。请帮忙。提前谢谢

import UIKit
import FBSDKLoginKit
import FBSDKShareKit


class ViewController: UIViewController, FBSDKLoginButtonDelegate, FBSDKSharingDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()
        let loginButton = FBSDKLoginButton()
        loginButton.center = view.center
        view.addSubview(loginButton)
        loginButton.delegate = self
    }

    func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) { 
        if (FBSDKAccessToken.current() != nil) { FBSDKGraphRequest(graphPath: "me", parameters: nil).start(completionHandler: 
            {(connection, result, error) in
                if error == nil {
                    print("fetch user \(result)")
                }
            })
        }
     }

    func loginButtonDidLogOut(_ loginButton: FBSDKLoginButton!) {
        print("you logout")
    }


    @IBAction func postImage(_ sender: Any) {
        let img = UIImage(named: "image")
        let content = FBSDKSharePhotoContent()
        content.photos = [FBSDKSharePhoto(image: img, userGenerated: true)]
        FBSDKShareAPI.share(with: content, delegate: self)   
    }

    func sharerDidCancel(_ sharer: FBSDKSharing!) {
        print("sharerDidCancel")
    }

    func sharer(_ sharer: FBSDKSharing!, didFailWithError error: Error!) {
        print("didFail")
    }

    func sharer(_ sharer: FBSDKSharing!, didCompleteWithResults results: [AnyHashable : Any]!) {
        print("didCompleteWithResult")
    }

}
试试这个:-

 @IBAction func postImage(_ sender: Any) {
    let img = UIImage(named: "image")
   let photo = FBSDKSharePhoto()
    photo.image = img
    photo.caption = "Test Caption"
    photo.isUserGenerated = true
    let content = FBSDKSharePhotoContent()
    content.photos = [photo]
    FBSDKShareAPI.share(with: content, delegate: self)   
}
试试这个:-

 @IBAction func postImage(_ sender: Any) {
    let img = UIImage(named: "image")
   let photo = FBSDKSharePhoto()
    photo.image = img
    photo.caption = "Test Caption"
    photo.isUserGenerated = true
    let content = FBSDKSharePhotoContent()
    content.photos = [photo]
    FBSDKShareAPI.share(with: content, delegate: self)   
}