Note that there are some explanatory texts on larger screens.

plurals
  1. POUITableView datasource must return cell... don't understand why cell is nil
    text
    copied!<p>I am writing a simple application in the iOS and I am getting the "<strong>UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:</strong>" error. I am trying to create some static row content. </p> <p><code>My view controller</code> is called <code>"StartViewController"</code>. In the .xib file I have 3 <code>UITableViewCell</code> <code>objects</code> called <code>"Section 0 Cell", "Section 1 Cell" and "Section 2 Cell"</code>. They are defined in the .h file as:</p> <pre><code>@interface StartViewController : UITableViewController { UITableViewCell *cell0; UITableViewCell *cell1; UITableViewCell *cell2; } @property (nonatomic, retain) IBOutlet UITableViewCell *cell0; @property (nonatomic, retain) IBOutlet UITableViewCell *cell1; @property (nonatomic, retain) IBOutlet UITableViewCell *cell2; </code></pre> <p>In the .m they have been synthesized. I can't post a picture of my interface builder as I don't have reputation 10 yet. </p> <p>The cells are populated like this:</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"Processing section: %d, row: %d",[indexPath section], [indexPath row]); if (cell0 == nil) NSLog(@"cell0 is nil"); if (([indexPath section] == 0) &amp;&amp; ([indexPath row] == 0)) return cell0; if (([indexPath section] == 1) &amp;&amp; ([indexPath row] == 0)) return cell1; if (([indexPath section] == 2) &amp;&amp; ([indexPath row] == 0)) return cell2; return cell0; } </code></pre> <p>I know the problem is the cell0 is nil but I can't figure out why. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload