【问题标题】:Facebook SDK Share Dialog Error for iOSiOS 的 Facebook SDK 共享对话框错误
【发布时间】:2014-02-26 15:54:41
【问题描述】:

无论我做什么,我在分享时都会收到此错误:

2014-02-03 00:13:36.392 Kurt Osiander[4443:60b] 发布故事时出错:错误 Domain=com.facebook.Facebook.platform Code=102 “操作无法完成。(com.facebook .Facebook.platform error 102.)" UserInfo=0x15d475b0 {error_message=发布时出错。, app_id=xxxxxxxxxx, error_code=102}

我禁用了沙盒模式,并在没有运气的情况下使用了开放图形选项 (Facebook posting error in ios)。我的代码附在下面:

// Check if the Facebook app is installed and we can present the share dialog

    FBShareDialogParams *params = [[FBShareDialogParams alloc] init];
    params.link = [NSURL URLWithString:@"https://http://www.kurtosiander.com/"];
    params.name = @"Kurt Osiander's Move of the Week";
    params.caption = @"Kurt Osiander's Move of the Week";
    params.picture = [NSURL URLWithString:@"http://a5.mzstatic.com/us/r30/Purple/v4/4b/7e/73/4b7e737c-bdc1-2aa5-3288-4e76c658235b/mzl.yafqehvw.175x175-75.jpg"];
    params.description = @"Kurt's iPhone app is finally available! Check it out now to learn all his moves, organized by position and submission.";

    // If the Facebook app is installed and we can present the share dialog
    if ([FBDialogs canPresentShareDialogWithParams:params]) {
        // Present share dialog
        NSLog(@"Present 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) {
                                          NSLog(@"handling");
                                          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);
                                          }
                                      }];

在我的应用委托中:

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
         annotation:(id)annotation {

    BOOL urlWasHandled = [FBAppCall handleOpenURL:url
                                sourceApplication:sourceApplication
                                  fallbackHandler:^(FBAppCall *call) {
                                      NSLog(@"Unhandled deep link: %@", url);
                                      // Here goes the code to handle the links
                                      // Use the links to show a relevant view of your app to the user
                                  }];

    return urlWasHandled;
}

【问题讨论】:

标签: ios objective-c facebook sdk share


【解决方案1】:

我有一个类似的问题,我认为它们是基于 facebook 显示名称的。你的有一个特殊的字符,而我的有一个德语变音符号。

所以我建议删除 facebook 应用程序和 plist 中的特殊字符 (')。 我希望这会有所帮助,即使这不是解决问题的方法 (FacebookDisplayName on iOS with german umlauts [SOLVED])。

更新:我找到了灵魂!问题是 utf8 字符串表示和链接字符串比较差异的结果。 这是我的解决方法:

[FBSettings setDefaultDisplayName:[[FBSettings defaultDisplayName] precomposedStringWithCanonicalMapping]];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-01
    • 1970-01-01
    • 2014-02-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多