[英]I can't share a content from my iOS app to the Facebook when Facebook app is installed
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];
}
I have gone through many stackoverflow questions and tried almost all. 我经历了很多stackoverflow问题,并尝试了几乎所有。 Some users reported it as bug, If so do we have any other way through which I can achieve my goal.
一些用户将其报告为错误,如果是这样,我们还有其他任何方式可以实现我的目标。 It works like charm when Facebook app is not there but when the app is there this won't work :
当Facebook应用程序不存在时,它就像魅力一样,但当应用程序存在时,这将无效:
[controller addURL:[NSURL URLWithString:@"www.awesomeapp.com"]];
Please help me achieve my goal. 请帮我实现目标。 Thanks in advance.
提前致谢。
I too headed up with is problem,some how i managed with FBSDKShareKit 我也是一个问题,一些我如何管理FBSDKShareKit
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:@"https://i.vimeocdn.com/portrait/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
}
In my pod file: 在我的pod文件中:
pod 'FBSDKShareKit', '~> 4.6.0'
dialog.mode = FBSDKShareDialogModeFeedBrowser it opens a fbShareDialog within your app which consist of all given datas. dialog.mode = FBSDKShareDialogModeFeedBrowser它在你的应用程序中打开一个fbShareDialog,它包含所有给定的数据。 Try some other alternatives for mode such as FBSDKShareDialogModeShareSheet,FBSDKShareDialogModeBrowser,FBSDKShareDialogModeWeb... it may also help you.
尝试一些其他替代模式,如FBSDKShareDialogModeShareSheet,FBSDKShareDialogModeBrowser,FBSDKShareDialogModeWeb ...它也可以帮助你。 I found FBSDKShareDialogModeFeedBrowser as satisfying.
我发现FBSDKShareDialogModeFeedBrowser令人满意。 Try it,Let me know whether it works or not.
试试吧,让我知道它是否有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.