【问题标题】:facebook share fb-event with webdialog (on iOS)facebook 与 webdialog 共享 fb-event(在 iOS 上)
【发布时间】:2014-02-21 11:29:40
【问题描述】:

您好,我有以下问题。 如果我从 iOS 应用程序共享一个 facebook 事件 url(如 https://www.facebook.com/events/),我有两个可能性: (1) iOS facebook app 已安装 (2) iOS facebook app 未安装

我的情况 1 一切正常。 facebook 应用程序获取事件信息,显示正确的预览,并且 facebook 墙上的帖子是正确的。 在案例 2 中,我使用 FBWebDialods 类,它显示了没有图片的预览,而且 Facebook 墙上的帖子只是文本。没有图像,也没有参加按钮。

有人知道我如何在这两种情况下在 facebook 墙上获得相同的结果帖子吗?

【问题讨论】:

    标签: ios facebook share


    【解决方案1】:

    我收到了https://developers.facebook.com/docs/ios/share/的回复:

    // Check if the Facebook app is installed and we can present the share dialog
    FBShareDialogParams *params = [[FBShareDialogParams alloc] init];
    params.link = [NSURL URLWithString:@"https://developers.facebook.com/docs/ios/share/"];
    params.name = @"Sharing Tutorial";
    params.caption = @"Build great social apps and get more installs.";
    params.picture = [NSURL URLWithString:@"http://i.imgur.com/g3Qc1HN.png"];
    params.description = @"Allow your users to share stories on Facebook from your app using the iOS SDK.";
    
    // If the Facebook app is installed and we can present the share dialog
    if ([FBDialogs canPresentShareDialogWithParams:params]) {
      // Present the share dialog
    } else {
      // Present the feed dialog
    }
    

    并在展示您添加的共享对话框中:

    [FBDialogs presentShareDialogWithLink:params.link
                                     name:params.name
                                  caption:params.caption
                              description:params.description
                                  picture:params.picture
                              clientState:nil
                                  handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
                                    if(error) {
                                      // An error occurred, we need to handle the error
                                      // See: https://developers.facebook.com/docs/ios/errors
                                      NSLog([NSString stringWithFormat:@"Error publishing story: %@", error.description]);
                                    } else {
                                      // Success
                                      NSLog(@"result %@", results);
                                    }
                                  }];
    

    希望对你有帮助

    【讨论】:

    • 就像我在问题中所写的那样,我已经在共享和提要对话框之间使用了这个切换。如果安装了 facebook 应用程序,共享对话框中的一切都可以正常工作。我的问题是如何在共享 facebook 事件时使用具有相同结果(图片、共享按钮)的提要对话框。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-01
    • 1970-01-01
    • 2015-06-11
    • 2017-07-01
    • 1970-01-01
    相关资源
    最近更新 更多