如何使用SLComposeViewController检测用户是否成功共享到Facebook

时间:2016-11-08 07:57:48

标签: ios swift facebook slcomposeviewcontroller

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

我的代码如下:

@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)
    }
} 

1 个答案:

答案 0 :(得分:1)

问题解决了TQ

var delegate: alertDelegate?