3

I'm experiencing very strange behaviour with FacebookShare.

When I bring up the shared dialogue, I get the following screen on iOS.

enter image description here

Once I tap on Share With Your Facebook App, it doesn't trigger the shareDialog.completion at all (see below for code). But if I log in via the email/password shown underneath, it works.

I suppose the upper section is over the native app, while the lower part goes over the web. I have the native Facebook app already installed on my device.

let myContent = LinkShareContent(url: url!, quote: quote)
let shareDialog = ShareDialog(content: myContent)
shareDialog.mode = .automatic
shareDialog.presentingViewController = self
shareDialog.completion = { 
    result in
        switch result {
            case .success:
                print("Share: Success")
            case .cancelled:
                print("Share: Cancel")
            case .failed:
                print("Share: Fail")
            }
}
do {
    try shareDialog.show()
} catch {
    self.notifyUserOfSharingError()
}
Houman
  • 64,245
  • 87
  • 278
  • 460
  • There was a commit in 0.5 which I believe may fix your issue: https://github.com/facebook/facebook-swift-sdk/commit/f22241bcc2c9928c5fe5d696ff5776ad044851a4. – Pranav Kasetti Jan 31 '19 at 11:52
  • If not, I know there was a bug in the objective c sdk which this one bridges: https://stackoverflow.com/questions/32299271/facebook-sdk-login-never-calls-back-my-application-on-ios-9/32300235#32300235. Maybe we could try something similar, as it seems you are using a webview here. – Pranav Kasetti Jan 31 '19 at 11:56
  • Thank you for your help. I checked the code and I have the latest commit that you mentioned already. When I change `shareDialog.mode = .native` then I get this error message thrown: `dialogNotAvailable` Hence I use automatic instead, and that opens the webview. However sharing with that button on top of the webview doesn't work. – Houman Feb 01 '19 at 00:36
  • For me, I have copied your code, installed the Facebook app, and the share dialog web view you have showed in your screenshot is not displaying. I get an error dialog immediately saying, you need to log in to share. If I log in via Facebook app, it allows me to share and callbacks are called. – Pranav Kasetti Feb 10 '19 at 11:58

0 Answers0