ios - How to detect user successfully shared to Facebook with SLComposeViewController -
i created button in app share status on facebook slcomposeviewcontroller
. how check whether user click share status?
my code below:
@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 facebook account share.", preferredstyle: uialertcontrollerstyle.alert) alert.addaction(uialertaction(title: "ok", style: uialertactionstyle.default, handler: nil)) self.present(alert, animated: true, completion: nil) } }
problem solved tq
fbshare.completionhandler = { (result:slcomposeviewcontrollerresult) -> void in switch result { case slcomposeviewcontrollerresult.cancelled: print("cancelled") break case slcomposeviewcontrollerresult.done: print("done") break } }
Comments
Post a Comment