У меня есть твиттер-фид, содержащий 12 фидов, поступающих в NSArray, из которого я извлекаю первый твит в строку NSString.
(void)statusesReceived:(NSArray *)statuses forRequest:(NSString *)connectionIdentifier
{
NSString *status = [statuses objectAtIndex:0];
NSLog(@"%@", status);
}
Мой твиттер введен в формате JSON, и из этого я хочу получить только сообщение о состоянии, помеченное как «текст», и имя пользователя, помеченное как «имя».Твиттер выглядит так:
{
contributors = "";
coordinates = "";
"created_at" = "Mon Feb 27 23:12:09 +0000 2012";
favorited = false;
geo = "";
id = XXXXXXXXXXXXXXXXXXX;
"in_reply_to_screen_name" = "";
"in_reply_to_status_id" = "";
"in_reply_to_user_id" = "";
place = "";
"possibly_sensitive" = false;
"retweet_count" = 23;
retweeted = false;
source = "<a href=\"http://www.hootsuite.com\" rel=\"nofollow\">HootSuite</a>";
"source_api_request_type" = 1;
text = "Check out the best on-court chatter from the @NBAAllStar Game, including Dwight challenging Kobe. http://tq.com/nIIzKNGc";
truncated = 0;
user = {
"contributors_enabled" = true;
"created_at" = "Mon Feb 02 19:04:42 +0000 2009";
"default_profile" = false;
"default_profile_image" = false;
description = "News and notes directly from the NBA.";
"favourites_count" = 15;
"follow_request_sent" = false;
"followers_count" = 4193000;
following = 1;
"friends_count" = 963;
"geo_enabled" = false;
id = 19923144;
"is_translator" = false;
lang = en;
"listed_count" = 26799;
location = "New York, NY";
name = NBA;
notifications = false;
"profile_background_color" = B2DFDA;
"profile_background_image_url" = "http://a0.twimg.com/profile_background_images/435033246/12twitter_0226.jpg";
"profile_background_image_url_https" = "https://si0.twimg.com/profile_background_images/435033246/12twitter_0226.jpg";
"profile_background_tile" = false;
"profile_image_url" = "http://a0.twimg.com/profile_images/1787324427/National-Basketball-Association_normal.jpg";
"profile_image_url_https" = "https://si0.twimg.com/profile_images/1787324427/National-Basketball-Association_normal.jpg";
"profile_link_color" = 93A644;
"profile_sidebar_border_color" = eeeeee;
"profile_sidebar_fill_color" = ffffff;
"profile_text_color" = 333333;
"profile_use_background_image" = true;
protected = 0;
"screen_name" = NBA;
"show_all_inline_media" = true;
"statuses_count" = 24335;
"time_zone" = "Eastern Time (US & Canada)";
url = "http://www.nba.com";
"utc_offset" = "-18000";
verified = true;
};
}