iossqlitetableviewnsindexpathrowid

property 'row' not found on object of type 'NSIndexPath *' in iOS tableview


I tried to fetch row id of an item with the help of "didSelectRowAtIndexPath" in iOS. Code:

   - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{  

      indexPathRow=indexPath.row;  

      self.recordIdToEdit = [[[deviceNameArray objectAtIndex:indexPath.row] objectAtIndex:0] intValue];  
      NSLog(@"Item selected..%d", self.recordIdToEdit);  

     [self performSegueWithIdentifier:@"DetailsViewController" sender:nil];  

  }  

While debugging i get following error for po :

 (lldb) po [deviceNameArray objectAtIndex:indexPath.row]  
 error: property 'row' not found on object of type 'NSIndexPath *'  
 error: 1 errors parsing expression  
 (lldb) po indexPathRow  
 <nil>  

What's going wrong here? deviceNameArray is an array of string that contains result fetched from sqlite db.


Solution

  • Try this while debugging we need to send int value

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{  
    
             int index=indexPath.row;  
    
              self.recordIdToEdit = [[deviceNameArray objectAtIndex:index]];  
              NSLog(@"Item selected..%d", self.recordIdToEdit);  
    
             [self performSegueWithIdentifier:@"DetailsViewController" sender:nil];  
    
          }