iOS Dev:用于UITableView标签的NSArray返回'index 1 out of bounds'

Gday,试图将我的循环tableview数组拆分成它自己的静态数组,然后在UITableView的每个标签上使用…

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"ListingCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } //Load Row Value into NSArray NSString *RowValues = [self.ListingArray objectAtIndex:[indexPath row]]; NSArray *RunTimeArray = [RowValues componentsSeparatedByString:@","]; //Configure the cell. cell.detailTextLabel.text = [RunTimeArray objectAtIndex:1]; //small label cell.textLabel.text = [RunTimeArray objectAtIndex:0]; //main title return cell; } 

当我运行该项目时,它会返回一个错误:

 DATE APP_NAME[28399:c07] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]' 

基本上这意味着索引:1不存在,但索引:0做……当我重新join数组与例如“——-”它都显示正确,所以它的含义新的对象有一个不同的索引到1或另一个连续的数字。

任何想法如何让他们连续索引,如:0,1,2,3,4而不是0,21581,2185929,385749 …

谢谢 :)

validation以下事情

1)在numberOfRowsInSection中返回的值应该是[self.listingArray count];

2)RunTimeArray计数应该总是> = 2。