-[UITableViewRowData isEqualToString:]: unrecognized selector sent to instance 0x391dce0
- by tak
I have a datatable which shows the list of contacts. when I start the application all the data is loaded correctly.But after selecting a contact, I am sometimes getting this exception :-
Program received signal: “EXC_BAD_ACCESS”.
and sometimes
-[UITableViewRowData isEqualToString:]: unrecognized selector sent to instance 0x391dce0
most probably for this code:-
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
ExpenseTrackerAppDelegate *appDelegate = (ExpenseTrackerAppDelegate *)[[UIApplication sharedApplication] delegate];
Person *person = (Person *)[appDelegate.expensivePersonsList objectAtIndex:indexPath.row];
NSString *name = (NSString *)[NSMutableString stringWithFormat:@"%@ %@" ,person.lastName , person.firstName];
cell.textLabel.text = name;
//cell.detailTextLabel.text = person.lastName;
// Configure the cell.
return cell;
}
If I replace these lines of code
NSString *name = (NSString *)[NSMutableString stringWithFormat:@"%@ %@" ,person.lastName , person.firstName];
cell.textLabel.text = name;
with this code
cell.textLabel.text = person.lastName;
then everything works fine?
I dont know what exactly happens?