无法在Facebook App中生成故事

时间:2013-12-31 09:31:25

标签: javascript facebook-graph-api facebook-javascript-sdk opengraph

嗨,我正在使用facebook open graph javascript SDK发布动作和自定义对象。 一切运行正常,直到响应中出现javascript错误。

错误:

“(#100)缺少必需值的对象:'gourmet-table:recipe'类型的URL''对象无效,因为未提供'string'类型的必需属性'og:title' 。“

facebook中的活动日志会创建故事,但它不会在应用中生成故事。因此,我无法将其发送给Facebook开发人员进行审核,以便所有用户都可以使用..

JS CODE:

FB.api('me/objects/gourmet-table:recipe', 'post', {
                object: {
                    app_id: AppId,
                    type: 'gourmet-table:recipe',
                    url: link,
                    title: title,
                    image: imageUrl
                }

            },
            function(response) {
                var Id = response;
                console.log(response);

                FB.api('me/gourmet-table:read_recipe', 'post', {recipe:Id},
                function(response) {
                 console.log(response);
                });
            });

您可以使用

中的任何开发工具检查链接和调试

URL:

http://gourmettable.in/recipe/gingerbread-cookies/

在控制台中,您将收到错误。

您的帮助将不胜感激..

由于

1 个答案:

答案 0 :(得分:0)

终于解决了问题..这是我身边的粗心......为此而烦恼

FB.api('me/objects/gourmet-table:recipe', 'post', {
                object: {
                    app_id: AppId,
                    type: 'gourmet-table:recipe',
                    url: link,
                    title: title,
                    image: imageUrl
                }

            },
            function(response) {
                //var Id = response; // Error Was Here.. Instead of This
                var Id = response.id; // response.id will return the object id.. I was returning the whole object instead of "id" ..
                console.log(response);

                FB.api('me/gourmet-table:read_recipe', 'post', {recipe:Id},
                function(response) {
                 console.log(response);
                });
            }); 

很抱歉给您带来不便:)