Facebook自定义故事,#100对象缺少必需的值...未提供属性'appnamespace:''类型为'string'。“

时间:2014-01-25 16:45:50

标签: javascript facebook-graph-api

对于自定义故事,使用用户拥有的对象(没有用于解析FB的URL)我定义了自定义属性但是我收到错误#100 ...

这是代码:

FB.api(
  'me/objects/appnamespace:CustomStory',
  'post',
  { object:
    { 
    "title": "story title",    
    "t_name":"watching FOX news",
    "main_a": "custom prop 1",
    "main_b": "custom prop 2",
    "description": "test post tracked trigger"
     }
   },
  function(response) {
    console.log(response);
  }
);

错误说appnamespace:CustomStory属性main_a未定义 这很奇怪,因为它就在那里......

提前感谢您的想法...

1 个答案:

答案 0 :(得分:0)

哦....所以解决方法是将自定义属性包含在一个包含Object ala的“data”属性中:

FB.api(
  'me/objects/appnamespace:CustomStory',
  'post',
  { object:
    {"title": "storty title",
    "data": {                      // put custom property values here
        "main_a": "value 1",
        "main_b": "value 2",
        "t_name": "another property"
    },
   "description": "test post tracked trigger"
     }
   },
  function(response) {
    console.log(response);
  }
);