Friday, 13 September 2013

App crashes at DidSelectRowAtIndexPath in xcode

App crashes at DidSelectRowAtIndexPath in xcode

My app crashes when I click on a record that sets text value in a text
label and when the value passed is empty.
- (void) tableView: (UITableView *)itemTableView didSelectRowAtIndexPath:
(NSIndexPath *)indexPath{
NSDictionary *obj = [self.dataCustomerDetailRows
objectAtIndex:indexPath.row];
self.textfieldCustomerName.text = [obj objectForKey:@"Name"];
self.textfieldCustomerPhoneNumber.text = [obj objectForKey:@"Phone"];
self.textfieldCounty.text = [obj objectForKey:@"Name"];
The record that causes the error is one that has no value returned in the
"Phone" obj, how can I code to handle this, e.g., where value is NULL,
replace with 0.

No comments:

Post a Comment