Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SLComposeViewController for FaceBook always returns SLComposeViewControllerResult.Done

Just recently my standard sharing-code was working as expected. When the user cancelled a Facebook share, the SLComposeViewController.completionHandler returned SLComposeViewControllerResult.Cancelled

Now however, after updates made by Apple or Facebook (the changes include a new design for the compose view), the completionHandler always gets the result Done.

I get the same behaviour on:

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

Anybody 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) {
        }
like image 355
Andreas Øverland Avatar asked Nov 10 '22 03:11

Andreas Øverland


1 Answers

Do you have the Facebook app installed when you are testing this? If not, that can explain this behaviour. See also this comment: https://developers.facebook.com/bugs/608854599254853/?comment_id=565037930316792

like image 85
Roemer Avatar answered Dec 05 '22 20:12

Roemer