I am trying to set up Facebook sharing with FBSDK in my iOS app.
I have been reading the documentation here, and currently have
[FBSDKShareDialog showF
I had to login and then Post , that is how it worked :
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logInWithReadPermissions:@[@"email"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
{
if (error)
{
// Process error
}
else if (result.isCancelled)
{
// Handle cancellations
}
else
{
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:@"https://developers.facebook.com/"];
FBSDKMessageDialog *messageDialog = [[FBSDKMessageDialog alloc] init];
messageDialog.delegate = self;
[messageDialog setShareContent:content];
if ([messageDialog canShow])
{
[messageDialog show];
}
else
{
// Messenger isn't installed. Redirect the person to the App Store.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://itunes.apple.com/en/app/facebook-messenger/id454638411?mt=8"]];
}
}
}];
and the Share Delegate :
- (void)sharer:(id)sharer didCompleteWithResults:(NSDictionary *)results
{
NSLog(@"didCompleteWithResults");
}
- (void)sharer:(id)sharer didFailWithError:(NSError *)error
{
NSLog(@"didFailWithError ::: %@" , error);
}
- (void)sharerDidCancel:(id)sharer
{
NSLog(@"sharerDidCancel");
}
Edit:
[messageDialog canShow] returns NO on the iPad, works fine on iPhone
Posted the issue on Facebook Developers forum.