Ошибка:Какова ошибка «Прекращение приложения»?
* Нагрузочный приложение из-за неперехваченного исключением 'NSRangeException', причина: '* - [__ NSArrayM objectAtIndex]: индекс 1 за пределами [0 .. 0]
Вот мой код:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"AartiTableViewCell";
AartiTableViewCell *cell = (AartiTableViewCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"AartiTableViewCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
cell.btnFav.userInteractionEnabled=YES;
}
NSString *strfavarry = [NSString stringWithFormat:@"SELECT Title FROM %@ WHERE identifire='%@'",[FavTablename objectAtIndex:indexPath.row],[FavIdent objectAtIndex:indexPath.row]];
FavTitle = [FavData lookupAllForSQL:strfavarry];
cell.selectionStyle=UITableViewCellSelectionStyleNone;
cell.index = indexPath.row;
cell.btnFav.tag=indexPath.row;
[cell.btnFav setBackgroundImage:[UIImage imageNamed:@"unfav.png"] forState:UIControlStateNormal];
[cell.btnFav addTarget:self action:@selector(handleFavouriteButton:) forControlEvents:UIControlEventTouchUpInside];
cell.lbltitle.text=[FavTitle objectAtIndex:indexPath.row];
return cell;
}
С какими ошибками у вас возникли проблемы? Отладчик покажет точное место, где проблема. –
из-за индекса 1 за пределами границ [0 .. 0] – seggy
где заполнить массив FavTablename и FavIdent, потому что этот массив может быть меньше значения вашего числа числовых чисел. –