简体   繁体   English

iOS 6上的本机Facebook分享

[英]Native Facebook share on iOS 6

I was wondering if I need to create a facebook app to do a share on facebook. 我想知道是否需要创建一个Facebook应用程序以在Facebook上进行共享。

I don't want the user to actually login or something like this. 我不希望用户实际登录或类似的东西。

As I see in the facebook docs it says that the prerequisite is to "make sure you already set up Facebook Login". 正如我在facebook文档中看到的那样,它说前提是“确保您已经设置了Facebook登录名”。 I wanted to know if this is really needed or is something I can by pass, since the user is already logged in on their native facebook app. 我想知道这是否真的需要或我可以通过,因为用户已经在其本机Facebook应用程序上登录。

I think you are talking about to store id and password of facebook. 我认为您正在谈论存储Facebook的ID和密码。

you should do it from settings... and also you can check by logic that facebook id and password is entered or not.. if not then session will go for login page otherwise it ll just share the perticular thing. 您应该从设置中执行此操作...,还可以通过逻辑检查是否输入了Facebook ID和密码。.如果未输入,则会话将进入登录页面,否则它将共享特定的内容。

Hope this Helps you... 希望这对您有帮助...

Here is what I was talking about: 这是我在说的:

#pragma mark - Share

- (void)sharingStatus {
    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
        NSLog(@"service available");
        self.shareButton.enabled = YES;
        self.shareButton.alpha = 1.0f;
    } else {
        self.shareButton.enabled = NO;
        self.shareButton.alpha = 0.5f;
    }
}

- (IBAction)facebookPost:(id)sender {

    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {

        SLComposeViewController *mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];


        NSString *shareText = @"This is my share post!";
        [mySLComposerSheet setInitialText:shareText];

        [mySLComposerSheet addImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:self.imageURL]]];

        [mySLComposerSheet addURL:[NSURL URLWithString:@"http://yourURL.com"]];

        [mySLComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) {

            switch (result) {
                case SLComposeViewControllerResultCancelled:
                    NSLog(@"Post Canceled");
                    break;
                case SLComposeViewControllerResultDone:
                    NSLog(@"Post Sucessful");
                    break;
                default:
                    break;
            }
        }];

        [self presentViewController:mySLComposerSheet animated:YES completion:nil];
    }
}

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

相关问题 iOS Facebook本机共享对话框:初始文本 - iOS Facebook Native Share Dialog : initial text iOS Native Facebook不共享互联网回调 - iOS Native Facebook Share no internet callback iOS6本机Facebook分享对话框网址 - iOS6 native facebook share dialog url 适用于iOS 6.0的Facebook SDK本机“共享”对话框 - Facebook SDK for iOS 6.0 native Share dialog iOS 9上的Facebook共享按钮打开浏览器而不是本机Facebook应用程序 - Facebook share button on iOS 9 opens browser instead of native Facebook app 使用本机“共享”对话框发布到Facebook时的iOS错误-UICGColor encodeWithCoder - IOS erro at Posting to Facebook with the native Share dialog - UICGColor encodeWithCoder iOS:通过UIWebView共享链接打开Facebook本机应用程序 - iOS: Open Facebook native app from UIWebView share link 从iOS发送的Facebook本机共享对话框而不是FbAppName? - Facebook native share dialog sent from iOS and not FbAppName? 无法在本机Facebook共享对话框中的ios9中设置initialtext - Unable to set initialtext in ios9 in native facebook share dialog 是否可以生成一个“在 Facebook 上分享”链接,在 Android/iOS/手机上打开原生 Facebook 应用程序而不是网络共享对话框? - Is it possible to generate a 'share on Facebook' link that opens the native Facebook App on Android/iOS/mobile instead of the web share dialog?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM