Twitter直接消息 - iPhone

时间:2011-06-17 18:01:48

标签: iphone api twitter messages

我一直在尝试检索直接消息并将它们放入时间轴。我已经成功地这样做了,但这不是我想要的方式......我有点困惑,似乎无法找到问题的答案。

我收到了尽可能多的直接消息但我将它们放在桌面视图中时会出现问题。

如果您对Twitter有所了解,那么直接消息就是向您发送消息的用户列表,然后您单击其中一个并向您显示实际消息。

所以我尝试只使用“user_id”,因为在日志返回的项目列表中显示用户ID,但仍然执行相同的操作。 user_id,scrren_name,profile_image_url都是主词典“发件人”收件人的子目录“但当我将它们放在表格视图中时,我只是崩溃.....

下面是我如何解析objets并且它们工作但我隐约似乎做了它应该做的事情

任何帮助都非常有用!

//_______________________________________________________________
//  DirecctMessages Parse
//_______________________________________________________________

-(NSString*)sender {

return [contents objectForKey:@"sender"]   ; 



}




-(NSString*)sender_id {

return [[contents objectForKey:@"sender"] objectForKey:@"sender_id"]  ; 



}


-(NSString*)sender_screenName {

return [[contents objectForKey:@"sender"] objectForKey:@"screen_name"]  ; 



}

-(NSString*)sender_profileImage {

return [[contents objectForKey:@"sender"] objectForKey:@"profile_image_url"]  ; 



}

这是日志

"created_at" = "Fri Jun 17 03:11:25 +0000 2011";
id = 3279750226;
recipient =     {
    "contributors_enabled" = false;
    "created_at" = "Wed Nov 10 10:58:54 +0000 2010";
    "default_profile" = false;
    "default_profile_image" = false;
    description = "Creator of xQuisite HD, Omega HD, AfterHours-HD, BlueBird-HD, ..a web  
and IOS5 http://www.youtube.com/user/FreeAppl3";
    "favourites_count" = 1;
    "follow_request_sent" = false;
    "followers_count" = 935;
    following = 1;
    "friends_count" = 256;
    "geo_enabled" = true;
    id = 214019964;
    "is_translator" = false;
    lang = en;
    "listed_count" = 23;
    location = "From NY 518 in Houston 281";
    name = "Anthony Cornell";
    notifications = false;
    "profile_background_color" = 131516;
    "profile_background_image_url" = 
"http://a2.twimg.com/profile_background_images/256254613/top-wrapper-bg.jpg";
    "profile_background_tile" = true;
    "profile_image_url" = 
"http://a2.twimg.com/profile_images/1361674958/Wintboard_200px_normal.png";
    "profile_link_color" = 0485db;
    "profile_sidebar_border_color" = eeeeee;
    "profile_sidebar_fill_color" = efefef;
    "profile_text_color" = 0896f5;
    "profile_use_background_image" = true;
    protected = 0;
    "screen_name" = FreeAppl3;
    "show_all_inline_media" = false;
    "statuses_count" = 6166;
    "time_zone" = "";
    url = "http://idevicethemes.com";
    "utc_offset" = "";
    verified = false;
};
"recipient_id" = 214019964;
"recipient_screen_name" = FreeAppl3;
sender =     {
    "contributors_enabled" = false;
    "created_at" = "Tue Jul 27 15:12:30 +0000 2010";
    "default_profile" = false;
    "default_profile_image" = false;
    description = "Currently a private platform..The one place all Geeks meet. One place 
to call home. We are not building an army. WE are building a Legion. #bAdGB";
    "favourites_count" = 12;
    "follow_request_sent" = false;
    "followers_count" = 699;
    following = 0;
    "friends_count" = 126;
    "geo_enabled" = false;
    id = 171526185;
    "is_translator" = false;
    lang = en;
    "listed_count" = 30;
    location = "Houston/U.S.A";
    name = bAdGB;
    notifications = false;
    "profile_background_color" = C0DEED;
    "profile_background_image_url" =   
"http://a3.twimg.com/profile_background_images/154928929/geek.jpg";
    "profile_background_tile" = true;
    "profile_image_url" = 
"http://a2.twimg.com/profile_images/1320730007/ProfilePhoto_normal.png";
    "profile_link_color" = 0084B4;
    "profile_sidebar_border_color" = C0DEED;
    "profile_sidebar_fill_color" = DDEEF6;
    "profile_text_color" = 333333;
    "profile_use_background_image" = false;
    protected = 0;
    "screen_name" = bAdGigabit;
    "show_all_inline_media" = false;
    "statuses_count" = 3088;
    "time_zone" = "Central Time (US & Canada)";
    url = "http://www.bAdGB.com";
    "utc_offset" = "-21600";
    verified = false;
};
"sender_id" = 171526185;
"sender_screen_name" = bAdGigabit;
"source_api_request_type" = 13;
text = "Dude. U should add a function to let the user get push updates on a themer   he  
subscribes too ";
}

1 个答案:

答案 0 :(得分:0)

是因为发件人对象中没有sender_id吗?而是尝试使用id