【问题标题】:Exception: 100 using Comment Facebook social plugin in a Facebook application (response code : 206)例外:100 在 Facebook 应用程序中使用评论 Facebook 社交插件(响应代码:206)
【发布时间】:2012-03-18 22:09:44
【问题描述】:

我正在使用下面的代码在 facebook 应用程序中使用 Comment 社交插件

<div class="fb-comments" data-href="<?php echo $fbconfig['appBaseUrl']; ?>" data-num-posts="20" data-width="480"></div>

其中 $fbconfig['appBaseUrl'] 是我的 Facebook 应用网址 (http://apps.facebook.com/[appname])

当用户发表评论时,评论与他的评论一起显示在时间线上,但也有这个例外:

"Uncaught Exception: 100: null does not resolve to a valid user ID"

我尝试使用开放图形调试器,但没有提供更多信息,除了 206 响应代码

http://developers.facebook.com/tools/debug/og/object?q=apps.facebook.com%2Fmesresolutions

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<br><b>Fatal error</b>
</head>
<body><p>:  Uncaught Exception: 100: null does not resolve to a valid user ID
  thrown in <b>/home/kastelni/www/facebook/mesresolutions/fb/base_facebook.php</b> on line <b>708</b><br></p></body>
</html>

您知道我的应用程序或插件有什么问题吗? 需要一些帮助;)

感谢您的帮助! 亚恩

【问题讨论】:

  • 我真的不明白。现在,当我在任何墙贴上发布应用程序的 URL 时会出现错误。有什么想法吗?

标签: facebook exception comments facebook-social-plugins


【解决方案1】:

找到了解决办法。

我正在测试当前用户是否是我的应用程序的粉丝。 但如果这是用户的第一次连接,则无法这样做。

对于那些对一段代码感兴趣的人:

$user       = $facebook->getUser();
$loginUrl   = $facebook->getLoginUrl(
        array(
            //'scope'         => 'email,publish_stream,user_birthday,user_location,user_work_history,user_about_me,user_hometown'
            'scope'         => 'user_about_me'
        )
);

if ($user) {
  try {
    // Proceed knowing you have a logged in user who's authenticated.
    $user_profile = $facebook->api('/me');
    $user_perm = $facebook->api('/me/permissions');
  } catch (FacebookApiException $e) {
    //you should use error_log($e); instead of printing the info on browser
    //d($e);  // d is a debug function defined at the end of this file
    $user = null;
  }
}

try
{
    if(isset($user_profile['id']))
    {
        //Est-ce que l'utilisateur est FAN
        $isFan = $facebook->api(array(
            "method"    => "pages.isFan",
            "page_id"   => $fbconfig['pageId'],
            "uid"       => $user_profile['id']
        ));
    }
    else
        $isFan = 0;
}   
catch(Exception $o){
    $isFan = 0;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-23
    • 2011-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-30
    相关资源
    最近更新 更多