繁体   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];
    }

我经历了很多stackoverflow问题,并尝试了几乎所有。 一些用户将其报告为错误,如果是这样,我们还有其他任何方式可以实现我的目标。 当Facebook应用程序不存在时,它就像魅力一样,但当应用程序存在时,这将无效:

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

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

我也是一个问题,一些我如何管理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令人满意。 试试吧,让我知道它是否有效。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM