我正在尝试从 Instagram 获取 JSON 提要以在我的 UITableView 中显示数据。但是我收到以下错误,我无法弄清楚问题是什么:
2013-08-18 10:20:37.361 ttoauth[38213:c07] -[__NSCFDictionary objectAtIndex:]:无法识别的选择器发送到实例 0x75d7480
2013-08-18 10:20:37.362 ttoauth[38213:c07] *** 终止应用程序due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0x75d7480'
*** First throw call stack: (0x13c8012 0x11ede7e 0x14534bd 0x13b7bbc 0x13b794e 0x3f68 0x1ec8fb 0x1ec9cf 0x1d51bb 0x1e5b4b 0x1822dd 0x12016b0 0x26abfc0 0x26a033c 0x26a0150 0x261e0bc 0x261f227 0x261f8e2 0x1390afe 0x1390a3d 0x136e7c2 0x136df44 0x136de1b 0x22c57e3 0x22c5668 0x131ffc 0x2a4d 0x2975)libc++abi.dylib:终止调用抛出异常
这是我的代码:
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
return [jsonResults count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
CustomCell *cell = (CustomCell *)[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
NSDictionary *instafeed_tableview = [jsonResults objectAtIndex:indexPath.row];
NSString *username_label = [[instafeed_tableview objectForKey:@"from"] valueForKey:@"username"];
cell.username.text = [NSString stringWithFormat:@"%@", username_label];
cell.username.clipsToBounds = YES;
cell.contentView.clipsToBounds = NO;
return cell;
}
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
-(CGFloat)tableView :(UITableView *)tableView heightForRowAtIndexPath :(NSIndexPath *)indexPath {
return 191;
}
我究竟做错了什么?