当我尝试向 facebook 发布操作时出现异常。
Exception :
{"error":{"message":"(#3502) Object at URL localhost/XXX has og:type of 'website'. The property 'myobject' requires an object of og:type 'mynamespace:myobject'. ","type":"OAuthException","code":3502}}
FB.api(
'/me/mynamespace:myaction',
'post',
{ myobject: url,
access_token: accessToken
},
function (response) {
if (!response || response.error) {
Alert(JSON.stringify(response));
}
});
我的网址从后端的模型生成:我的网址:http://localhost/post/og/
public ActionResult og(int id)
{
return View(new OGModel(id));
}
看法 :
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# @Model.NameSpace: http://ogp.me/ns/fb/@Model.NameSpace#">
<title>@Model.Title</title>
<meta property="fb:app_id" content="@Model.AppId" />
<meta property="og:type" content="@Model.NameSpace:myobject" />
<meta property="og:url" content="@Model.SharingLink">
<meta property="og:title" content="@Model.Title" />
<meta property="og:image" content="@Model.Image" />
</head>
<body>
<div>
</div>
</body>
</html>
任何想法?