Я пытаюсь следовать руководству, которое использует SBJsonParser для получения каналов Twitter и отображает их в виде таблицы.
Но я получаю следующую ошибку
[__NSCFDictionary isEqualToString:]: unrecognized selector sent to instance 0x6b7e510
это то, что в моем
@ interface NSString *json_string; NSArray *statusArray;
Это код, который я использую, чтобы получить твиттер
`SBJsonParser *parser = [[SBJsonParser alloc] init];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://twitter.com/statuses/public_timeline.json"]];
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
json_string = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
statusArray = [parser objectWithString:json_string error:nil];`
И это то, что я использую, чтобы поместить его в табличное представление
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return statusArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
cell.textLabel.text = [[statusArray objectAtIndex:indexPath.row] objectForKey:@"user"];
return cell;
}
РЕДАКТИРОВАТЬ:
Я NSLogged statusArray с objectatindex: 0, и я получил
{
contributors = "<null>";
coordinates = "<null>";
"created_at" = "Mon Mar 26 19:43:54 +0000 2012";
favorited = 0;
geo = "<null>";
id = 184365079062528000;
"id_str" = 184365079062528000;
"in_reply_to_screen_name" = "<null>";
"in_reply_to_status_id" = "<null>";
"in_reply_to_status_id_str" = "<null>";
"in_reply_to_user_id" = "<null>";
"in_reply_to_user_id_str" = "<null>";
place = "<null>";
"retweet_count" = 0;
retweeted = 0;
source = "<a href=\"http://blackberry.com/twitter\" rel=\"nofollow\">Twitter for BlackBerry\U00ae</a>";
text = "Kalau tidur jam segini engga mungkin bisa mimpi-___-";
truncated = 0;
user = {
"contributors_enabled" = 0;
"created_at" = "Tue Apr 27 18:28:24 +0000 2010";
"default_profile" = 0;
"default_profile_image" = 0;
description = "27June!";
"favourites_count" = 0;
"follow_request_sent" = "<null>";
"followers_count" = 733;
following = "<null>";
"friends_count" = 331;
"geo_enabled" = 1;
id = 137772903;
"id_str" = 137772903;
"is_translator" = 0;
lang = en;
"listed_count" = 0;
location = "";
name = "Faisal Maulana \U2606";
notifications = "<null>";
"profile_background_color" = 050505;
"profile_background_image_url" = "http://a0.twimg.com/profile_background_images/451260814/428031_258048570950875_100002372012794_560610_1320195241_n.jpg";
"profile_background_image_url_https" = "https://si0.twimg.com/profile_background_images/451260814/428031_258048570950875_100002372012794_560610_1320195241_n.jpg";
"profile_background_tile" = 1;
"profile_image_url" = "http://a0.twimg.com/profile_images/1962687246/IMG01822-20120319-1126_normal.jpg";
"profile_image_url_https" = "https://si0.twimg.com/profile_images/1962687246/IMG01822-20120319-1126_normal.jpg";
"profile_link_color" = 0a0a0a;
"profile_sidebar_border_color" = 161717;
"profile_sidebar_fill_color" = ffffff;
"profile_text_color" = 050505;
"profile_use_background_image" = 1;
protected = 0;
"screen_name" = IcalHuba;
"show_all_inline_media" = 0;
"statuses_count" = 60850;
"time_zone" = Greenland;
url = "<null>";
"utc_offset" = "-10800";
verified = 0;
};
}