SecondiosAppTutorial -- learning notes, learning notes app

Source: Internet
Author: User

SecondiosAppTutorial -- learning notes, learning notes app

I learned SecondiosAppTutorial more than half. When I run the program, I reported an error and finally found the problem. I was frustrated when I read the English document, but I was patient enough to find the problem. The prompt for Xcode was clear. As follows:

/* Debug output error message. TableView cell is null */*** Terminating app due to uncaught exception 'nsinternalinconsistencyexception', reason: 'uitableview dataSource must return a cell from tableView: cellForRowAtIndexPath :'

TableView has no return value, and the cell value is null. Design the implementation of TableView in MasterViewController. m, first from the code to find the problem.

1-(UITableViewCell *) tableView :( UITableView *) tableView cellForRowAtIndexPath :( NSIndexPath *) indexPath {2 2/* UITableViewCell * cell = [tableView progress: @ "Cell" forIndexPath: indexPath]; 3 3 4 4 4 NSDate * object = self. objects [indexPath. row]; 5 5 cell. textLabel. text = [object description]; 6 6 return cell; */7 7 static NSString * CellIdentifier = @ "BirdSightingCell "; /* BirdSightingCell is the Identifier attribute name of the cell in the table */8 8 9 9 static NSDateFormatter * formatter = nil; 10 10 10 if (formatter = nil) {11 11 formatter = [[NSDateFormatter alloc] init]; 12 12 [formatter setDateStyle: NSDateFormatterMediumStyle]; 13 13} 14 14 UITableViewCell * cell = [tableView identifier: CellIdentifier]; 15 15 NSLog (@ "111222% @", cell); 16 16 BirdSighting * sightingAtIndex = [self. dataController objectInListAtIndex: indexPath. row]; 17 17 [[cell textLabel] setText: sightingAtIndex. name]; 18 18 [[cell detailTextLabel] setText: [formatter stringFromDate :( NSDate *) sightingAtIndex. date]; 19 19 NSLog (@ "111222% @", cell); 20 20 return cell; 21 21 21}

Cell has no value. output information 15 and 19 are all null. Therefore, 7th rows may have errors. BirdSightingCell is the value of cell Identifier in TableView. It turns out that the value in the table is cell. Suddenly realized. The specific location is as follows:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.