Facebook Share Content Only Shares Url in iOS 9

Facebook share content only shares URL in iOS 9

I was having the same issue, and the workaround I'm using is to set the Share Dialog mode to use the native app.

I'm using Obj-C, but should be pretty much the same in Swift:

FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
dialog.fromViewController = viewController;
dialog.shareContent = content;
dialog.mode = FBSDKShareDialogModeNative; // if you don't set this before canShow call, canShow would always return YES
if (![dialog canShow]) {
// fallback presentation when there is no FB app
dialog.mode = FBSDKShareDialogModeFeedBrowser;
}
[dialog show];

In iOS 9 the user gets the app-switching dialog, but it works fine. There's also FBSDKShareDialogModeWeb, which doesn't have the app-switching dialog, but it doesn't show the image, either.

The default is FBSDKShareDialogModeAutomatic, which chooses FBSDKShareDialogModeShareSheet, which is what you're seeing.

UPDATE: This is the behavior in iOS9 for the available dialog modes:

  • FBSDKShareDialogModeAutomatic: uses ShareSheet, which is the OP case
  • FBSDKShareDialogModeShareSheet: ditto
  • FBSDKShareDialogModeNative: works if the user has the FB app installed, fails silently otherwise. Presents app-switch dialog.
  • FBSDKShareDialogModeBrowser: shares without image
  • FBSDKShareDialogModeWeb: shares without image
  • FBSDKShareDialogModeFeedBrowser: works as intended
  • FBSDKShareDialogModeFeedWeb: works as intended

"Browser" open Safari full-screen, "Web" opens a webview dialog.

I'd go with either of the last two options for iOS9 and Automatic for iOS8.

iOS 9 Facebook SDK Login/Share

This is by design.

In FB SDK v4.6 and v3.24, we default to Safari View Controller rather than fast-app-switching to the native Facebook app. In iOS 9 the fast-app-switch flow generates two interstitials "ExampleApp would like to open Facebook" and "Facebook would like to open ExampleApp".

For the hundreds of millions of people who are signed into Safari on iOS, they have an awesome experience.

Facebook SDK Share Link content gets replaced by meta data from content URL

Figured this out in case anyone else has the same problem.
This occurs consistently if the URL you are sharing is an iTunes App Store URL. Changing the URL to any other website solved the problem.

https://developers.facebook.com/docs/sharing/ios
"Note: If your app share links to the iTunes or Google Play stores, we do not post any images or descriptions that you specify in the share. Instead we post some app information we scrape from the app store directly with the Webcrawler. This may not include images. To preview a link share to iTunes or Google Play, enter your URL into the URL Debugger."

Can't add description and title to url using Facebook share link content

You should update your myContent and shareDialog parts like this:

        let myContent:FBSDKShareLinkContent = FBSDKShareLinkContent()
myContent.contentTitle = "Hello"
myContent.contentDescription = "Test message"
myContent.contentURL = (URL(string: "https://developers.facebook.com"))

let shareDialog = FBSDKShareDialog()
shareDialog.mode = .shareSheet
FBSDKShareDialog.show(from: self, with: myContent, delegate: nil)

You can also import and use Social library for creating Facebook share box. And control your share results with Facebook share delegate functions. Like this way:

import FBSDKShareKit
import Social

class YourViewController: UIViewController, FBSDKSharingDelegate {
func facebookShareButtonClicked() {
let vc = SLComposeViewController(forServiceType:SLServiceTypeFacebook)
vc?.add(UIImage(named: "YourImageName"))
vc?.add(URL(string: "https://developers.facebook.com")) //Your custom URL
vc?.setInitialText("Your sample share message...")
self.present(vc!, animated: true, completion: nil)
}

//Facebook share delegate functions:
func sharer(_ sharer: FBSDKSharing!, didCompleteWithResults results: [AnyHashable : Any]!) {
print("Success")
}

func sharer(_ sharer: FBSDKSharing!, didFailWithError error: Error!) {
print("didFailWithError: ", error)
}

func sharerDidCancel(_ sharer: FBSDKSharing!) {
print("Sharer cancelled")
}
}

Note: Try it with your device. It doesn't work on simulator. And be sure that the Facebook App is installed your device.



Related Topics



Leave a reply



Submit