I am following a tutorial in which I access the address book, let the user select contacts and store them into core data. After they are stored in core data, the modal view controller with the address book contacts is dismissed.
However, I have a strange problem where after it is dismissed, when you look at contacts, the tableview shows the new contact but the name does not display. It is not that the tableview is not updated at all. It does show the new contact. It just doesn't show the name. If you go to edit the contact (in a detail view) the name is there so it is getting stored in the database. But if you go back to tableview, the name is still missing.
Only when you save the edited version--even if you leave everything the same--does the name show up in the tableview.
This does not seem to be a delegate issue as the tableview is showing the new entry but it just does not show the first and last names.
Happy to show code if anyone wants, but not sure which code is most relevant.
Thanks for any suggestions.
Edit:
Problem does seem to be in cellforrowatindexpath method. The best name prints out as null although the first and last name are ok. However the best name concatenation does work normally. Not sure why it is not working here.
Contacts *contact = [self.fetchedResultsController objectAtIndexPath:indexPath];
//get best name
NSString *bestName = [contact.title stringByAppendingFormat:@" %@", contact.first];
bestName = [bestName stringByAppendingFormat:@" %@", contact.last];
NSLog(@"The best name is: %@", bestName); // prints Null
NSLog(@"The first name is: %@",contact.first);//prints Bob
NSLog(@"The last name is: %@",contact.last);//prints Jones
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPaththere you should have the object with the person on the address book and see why is not printing on the cell. - jberlana