【问题标题】:Mysterious magnifying glass in Facebook Feed DialogFacebook Feed 对话框中的神秘放大镜
【发布时间】:2014-05-19 10:46:00
【问题描述】:

我通过 CocoaPods 和 Podfile 安装了 Facebook iOS SDK

platform :ios, '6.0'
pod 'Facebook-iOS-SDK'

截图如下:

当我使用以下代码(在按钮的 IBAction 中)尝试向 Facebook 分享消息时,模拟器的右上角会出现一个放大镜(我按照 Getting Started 的教程进行操作):

FBShareDialogParams *params = [[FBShareDialogParams alloc] init];
params.link = [NSURL URLWithString:@"http://www.google.com"];
params.name = @"Google";
params.caption = @"Google is Great";
params.picture = [NSURL URLWithString:@"http://i.imgur.com/g3Qc1HN.png"];
params.description = @"Google is a good search engine";

if([FBDialogs canPresentShareDialogWithParams:params]) {
    // Present share dialog (requires Facebook App v6.0+ installed)
    [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) {
             NSLog(@"%@", [NSString stringWithFormat:@"Error publishing story: %@", error.description]);
         } else {
             NSLog(@"result %@", results);
         }
     }];
} else {
    // Present feed dialog
    NSMutableDictionary *params1 = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   @"Google", @"name",
                                   @"Google is Great", @"caption",
                                   @"Google is a good search engine", @"description",
                                   @"http://www.google.com", @"link",
                                   @"http://i.imgur.com/g3Qc1HN.png", @"picture",
                                   nil];

    [FBWebDialogs presentFeedDialogModallyWithSession:nil
                                           parameters:params1
                                              handler:^(FBWebDialogResult result, NSURL *resultURL, 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 {
                                                      if (result == FBWebDialogResultDialogNotCompleted) {
                                                          // User cancelled.
                                                          NSLog(@"User cancelled.");
                                                      } else {
                                                          // Handle the publish feed callback
                                                          NSDictionary *urlParams = [self parseURLParams:[resultURL query]];

                                                          if (![urlParams valueForKey:@"post_id"]) {
                                                              // User cancelled.
                                                              NSLog(@"User cancelled.");

                                                          } else {
                                                              // User clicked the Share button
                                                              NSString *result = [NSString stringWithFormat: @"Posted story, id: %@", [urlParams valueForKey:@"post_id"]];
                                                              NSLog(@"result %@", result);
                                                          }
                                                      }
                                                  }
                                              }];
}

在课程结束时,@end 之前:

// A function for parsing URL parameters returned by the Feed Dialog.
- (NSDictionary*)parseURLParams:(NSString *)query {
    NSArray *pairs = [query componentsSeparatedByString:@"&"];
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    for (NSString *pair in pairs) {
        NSArray *kv = [pair componentsSeparatedByString:@"="];
        NSString *val =
        [kv[1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        params[kv[0]] = val;
    }
    return params;
}

使用 Feed 对话框是因为模拟器没有 Facebook App v6.0+

放大镜完全挡住了“分享”按钮。如何删除它?

注意:安装的版本是v3.13.0(目前官方最新版本是3.13.1)。

注意:使用的 iOS 是 6.0、7.0、7.1。

【问题讨论】:

  • 这也发生在我们在 iOS 和 Android 上的极少数实时用户身上。我们的应用是用 Adob​​e AIR 编写的,并使用了 Facebook 的 Fresh Planet ANE。

标签: ios facebook cocoapods


【解决方案1】:

Facebook 在服务器端已解决此问题。放大镜已被移除。

无需更新 Facebook SDK。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-10-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多