ios swift social ios8

Social Framework iOS 8 swift



ios8 (2)

Pruebe el siguiente código, aún no probado

socialVC.completionHandler = { (result:SLComposeViewControllerResult) in // Your code }

Así que he estado escribiendo una aplicación que necesita utilizar el marco social para compartir texto a través de Twitter y Facebook.

Lo hice funcionar, pero no descartó (?), Entonces recordé el controlador de finalización, pero haga lo que haga, este manejador sigue dándome errores.

var okFacebook :Bool = SLComposeViewController.isAvailableForServiceType(SLServiceTypeFacebook) var okTwitter :Bool = SLComposeViewController.isAvailableForServiceType(SLServiceTypeTwitter) var okLinkedIn : Bool = SLComposeViewController.isAvailableForServiceType(SLServiceTypeLinkedIn) var socialVC :SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeTwitter) socialVC.completionHandler = SLComposeViewControllerCompletionHandler(SLComposeViewControllerResult) -> Void self.presentViewController(socialVC, animated: true, completion: nil)


override func viewDidLoad() { super.viewDidLoad() if SLComposeViewController.isAvailableForServiceType(SLServiceTypeFacebook){ var facebookSheet:SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook) facebookSheet.setInitialText("Hiya, I have just discovered this great app called Dwingle, which I think you''re going to love.") let url = NSURL(string: "") facebookSheet.addURL(url) self.presentViewController(facebookSheet, animated: true, completion: nil) facebookSheet.completionHandler = { result -> Void in self.dismissViewControllerAnimated(true, completion: { () -> Void in self.navigationController?.popToRootViewControllerAnimated(true) }) } } else { var 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.presentViewController(alert, animated: true, completion: nil) } }