简体   繁体   English

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

[英]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.

相关问题 在没有安装Facebook App的情况下,FBSDKShareDialog不会共享照片 - FBSDKShareDialog doesn't share Photo without Facebook App installed, IOS 未在手机上安装Facebook应用程序时,如何在iOS应用程序中将照片共享到Facebook? - How to share photo to Facebook within iOS app, when Facebook app is not installed on the phone? 如何从我的iOS应用程序将图像和文本共享到Facebook。 - How to share an image & text to Facebook from my iOS App. 如何通过我的iOS应用在Facebook上分享内容? - How to share something on facebook from my iOS app? Facebook iOS SDK分享来自App的图片 - Facebook iOS SDK share picture from App 如果安装了 Facebook 应用,Firebase iOS Facebook 身份验证将不起作用 - Firebase iOS Facebook authentication doesn't work if Facebook app is installed 如何在Facebook的iPhone应用程序中共享页面内容? - How can I share the contents of my page in iPhone app on facebook? iOS Facebook SDK分享照片并从Facebook应用注销后 - iOS Facebook SDK share photo and after logout from Facebook app 将我的应用中的图像分享到Facebook - Share an image from my app to facebook 安装Facebook应用程序的Facebook SDK iOS登录 - Facebook SDK iOS login with Facebook app installed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM