0
votes

I just migrated to Facebook iOS SDK 4.0 (from 3.0).

Sharing content is now done using the FBSDKShareKit framework. I am currently using the following sample code as suggested by the documentation :

FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
            content.contentURL = [NSURL URLWithString:@"http://www.apple.com"];
            FBSDKShareButton *button = [[FBSDKShareButton alloc] init];
            button.shareContent = content;

When I click on the button, I am redirected to the Facebook native app; but not sharing form is provided and nothing seems wrong according the console logs.

Notice that : * The App-Info.plist is well configured including FacebookAppId, FacebookDisplayName, as well as the URL types. * The AppDelegate.m class includes the appropriate changes as mentioned in Facebook documentation

Any reason why no form is prompted for the user to share the link?

1
When you say it opens the Facebook app, does it stay there (and doesn't return to your app)? Does it just show the newsfeed? What version of the FB app do you have on your device? - Ming Li
@MingLi That's exactly it. It just shows the newsfeed, does not return to my app and stays there. I have a 26.x version (not sure I dont have my phone right now). Thanks! - Romain Dorange
Does any of the sample projects that ships with the SDK work for you when it comes to sharing? - Ming Li
I found out why. I was using FacebookAppId instead of FacebookAppID. Thanks for pointing me towards the sample projects ! - Romain Dorange

1 Answers

1
votes

I had the similar issue today. I had a custom button set up manually and I was calling a custom FBSDKShareDialog from it. The call was resulting in error but NSError object it passed to the delegate was always nil (SDK issue probably). In the The Documentation's Share Dialog section it says the app always falls back to a browser dialog but it never actually did. So at first I installed the Facebook app on my device from the appstore and it got everything going. Then I found 'setMode' property of a FBSDKShareDialog object that let's you choose the way of sharing. unfortunately, if your choice is unavailable the callback is again NSError with nil. on the other hand setting it to 'FBSDKShareModeAutomatic' actually makes the fallback functional but this does not let you choose the sharedialog. Also, I just checked the reference and setMode is not available for FBSDKShareButton :( I'd suppose you set up a custom button and fbdialog and bind them together manually. the last sdk is kinda cranky.

I was going to comment but i don't have enough reputation. good luck.