Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FBSDKShareDialog doesn't share Photo without Facebook App installed, IOS

I am using Facebook SDK 4.0,https://developers.facebook.com/docs/sharing/ios#share_dialog I am using FBSDKShareDialog to share Photo.It does share Photo if user has installed Facebook app, But it fails when user hasn't installed FB App. but they say "If someone doesn't have Facebook app installed it will automatically falls back to a web-based dialog." Idk whats wrong please help me in sharing photo using FBSDK 4.0.

My code is

FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
photo.image = self.capturedImageView.image;
photo.userGenerated = YES;
FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
content.photos = @[photo];
[FBSDKShareDialog showFromViewController:self
                             withContent:content
                                delegate:self];

This is error report

enter image description here

error:"com.facebook.sdk:FBSDKErrorArgumentNameKey=shareContent, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Feed share dialogs support FBSDKShareLinkContent."

like image 233
Moaz Saeed Avatar asked Apr 01 '15 12:04

Moaz Saeed


2 Answers

FBSDKShareDialog only supports FBSDKShareLinkContent to post image or URL.So to use share Dialog you have to use FBSDKShareLinkContent.

enter image description here

You could use it as follows :

FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
    content.imageURL = [NSURL URLWithString:@"http://upload.wikimedia.org/wikipedia/commons/3/36/Hopetoun_falls.jpg"];
    [FBSDKShareDialog showFromViewController:self
                                 withContent:content
                                    delegate:self];

If you want to share a link then just use content.contentURL.

Refer to : https://developers.facebook.com/docs/sharing/ios#share_dialog

If you are using FBSDKSharePhoto then you need the native Facebook for iOS app installed.

Refer to :https://developers.facebook.com/docs/sharing/ios#photos

like image 89
Dheeraj Singh Avatar answered Sep 28 '22 04:09

Dheeraj Singh


I also had the same issue as the documentation is also saying that they provide fallback mechanisms, which seems not true for this case:

Built-In Share Fallbacks

In past versions of the SDK for iOS, your app had to check for a native, installed Facebook app before it could open the Share Dialog. If the person didn't have the app installed, you had to provide your own code to call a fallback dialog.

Now the SDK automatically checks for the native Facebook app. If it isn't installed, the SDK switches people to their default browser and opens the Feed Dialog. If someone wants to share an Open Graph story, the SDK opens the Web Share Dialog.

like image 25
ph1lb4 Avatar answered Sep 28 '22 04:09

ph1lb4