Andreas Øverland
Andreas Øverland

Reputation: 108

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:

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

Upvotes: 5

Views: 1375

Answers (1)

Roemer
Roemer

Reputation: 3576

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

Upvotes: 1

Related Questions