安装Facebook应用后,我无法将iOS应用中的内容共享给Facebook [英] I can't share a content from my iOS app to the Facebook when Facebook app is installed

查看:367
本文介绍了安装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应用程序时,它就像魅力一样工作,但是当该应用程序在那里时,它将不起作用:

I have gone through many stackoverflow questions and tried almost all. 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 :

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

请帮助我实现目标.预先感谢.

Please help me achieve my goal. Thanks in advance.

推荐答案

我也很头疼,这是一些我如何使用FBSDKShareKit进行管理的问题

I too headed up with is problem,some how i managed with 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
}

在我的pod文件中:

pod 'FBSDKShareKit', '~> 4.6.0'

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

dialog.mode = FBSDKShareDialogModeFeedBrowser it opens a fbShareDialog within your app which consist of all given datas. Try some other alternatives for mode such as FBSDKShareDialogModeShareSheet,FBSDKShareDialogModeBrowser,FBSDKShareDialogModeWeb... it may also help you. I found FBSDKShareDialogModeFeedBrowser as satisfying. Try it,Let me know whether it works or not.

这篇关于安装Facebook应用后,我无法将iOS应用中的内容共享给Facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆