SLComposeViewController for FaceBook always returns SLComposeViewControllerResult.Done

More recently, my standard exchange code worked as expected. When the user canceled the Facebook share, SLComposeViewController.completionHandler returned SLComposeViewControllerResult. Canceled

Now, however, after updates made by Apple or Facebook (the changes include a new design to represent the layout), completeHandler always gets the Finish result .

I get the same behavior:

  • iPhone 6s plus iOS 9.0.2 launch
  • iPhone 6 plus launch of iOS 9.0.2
  • iPhone 5s running iOS 8.2

Does anyone else have the same problem? Below is my code:

        let fbComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)

        fbComposeViewController.addURL( NSURL(string:"http://www.some.url.com/)"))
        fbComposeViewController.completionHandler = { (result:SLComposeViewControllerResult) -> Void in
            switch result {
            case SLComposeViewControllerResult.Cancelled:
                print("Cancelled") // Never gets called
                break

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

        self.presentViewController(fbComposeViewController, animated: true) {
        }
+4

Source: https://habr.com/ru/post/1612061/


All Articles