如何使用 SLComposeViewController 检测用户成功分享到 Facebook

How to detect user successfully shared to Facebook with SLComposeViewController

我在应用程序中创建了一个按钮,用于在 Facebook 上与 SLComposeViewController 分享状态。 如何查看用户是否真的点击分享状态?

我的代码如下:

@IBAction func fbBtn(_ sender: Any) {

    if SLComposeViewController.isAvailable(forServiceType: SLServiceTypeFacebook) {
        let fbShare:SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)

        self.present(fbShare, animated: true, completion: nil)

    } else {
        let alert = UIAlertController(title: "Accounts", message: "Please login to a Facebook account to share.", preferredStyle: UIAlertControllerStyle.alert)

        alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
        self.present(alert, animated: true, completion: nil)
    }
} 

问题已解决 TQ

fbShare.completionHandler = { (result:SLComposeViewControllerResult) -> Void in
            switch result {
            case SLComposeViewControllerResult.cancelled:
                print("Cancelled") 
                break

            case SLComposeViewControllerResult.done:
                print("Done")
                break
            }
        }