0

您好,我在 opengraph 工作了一段时间,但有些事情一直困扰着我。

我无法从提要中的每个人那里收到消息

  "data": [
    {
      "id": "984656456_1111111", 
      "from": {
        "name": "Xxx Some  Name", 
        "id": "478975485"
      }, 
      "message": "test", 
      "picture": "https://somepictureSomewhere.jpg", 
      "link": "https://www.facebook.com/photo.php?fbid=10151943257604861&set=p.101519&type=1&relevant_count=1", 
      "icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yz/r/StEh3RhPvjk.gif", 
      "actions": [
        {
          "name": "Comment", 
          "link": "https://www.facebook.com/589884/posts/10151943984861"
        }
      ], 
      "privacy": {
        "value": ""
      }, 
      "type": "photo", 
      "status_type": "added_photos", 
      "object_id": "1015194324861", 
      "created_time": "2013-10-24T12:54:43+0000", 
      "updated_time": "2013-10-24T12:54:43+0000"
    }
  ], 
  "paging": {
    "previous": "https://graph.facebook.com/58980/feed?limit=25&since=1382619283", 
    "next": "https://graph.facebook.com/58988/feed?limit=25&until=1382619282"
  }
}

这是我的代码,我收到以下错误:RuntimeBinder 异常未与 usersFeeds.message[i] 一起处理,而 UsersFeeds.data[i].from.name 工作正常。

  FacebookClient fb = new FacebookClient(access_token);
                dynamic UsersFeeds = fb.Get("/me/posts");
                int teller = (int)Usersfriends.data.Count;
                for (int i = 0; i < 10; i++)
                {
                    lstUsersFriends.Items.Add(UsersFeeds.data[i].from.name);
                    lstUsersFriends.Items.Add(UsersFeeds.message[i]);
                }
4

1 回答 1

0

您的迭代不应该基于计数吗?

FacebookClient fb = new FacebookClient(access_token);
dynamic UsersFeeds = fb.Get("/me/posts");
int teller = (int)Usersfriends.data.Count;
for (int i = 0; i < **teller**; i++)
{
    lstUsersFriends.Items.Add(UsersFeeds.data[i].from.name);
    lstUsersFriends.Items.Add(UsersFeeds.message[i]);
}
于 2013-10-31T02:07:04.077 回答