Tableview datasource not recognized

Discussion in 'Mac Programming' started by hervey, Sep 29, 2009.

  1. hervey macrumors newbie

    Sep 23, 2009
    Data from SQLite database is valid until - tableview cellForRowAtIndexPath. I've stripped down the code to it most basic, and still don't see the problem. Connections are made in IB, and data shows on console. Obviously I'm new to Cocoa/Obj C.

    Code in:

    -(UITableViewCell *)tableView:(UITableView *)tableView
    cellForRowAtIndexPath:(NSIndexPath *)indexPath
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:mad:"TableViewCell"];
    if (cell =nil) {
    cell = [[[UITableViewCell alloc]initWithFrame:CGRectZero
    reuseIdentifier: @"TableViewCell"] autorelease];
    NSUInteger row = [indexPath row];
    cell.textLabel.text = [cities objectAtIndex:row];
    return cell ;

    Error msg:

    *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
    2009-09-29 19:14:25.537 testAER[9939:20b]
  2. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    That's a bug. It should be equality test (==), not assignment (=).
  3. hervey thread starter macrumors newbie

    Sep 23, 2009
    chown33 -

    Thanks! I could have stared at that for another day and missed it. Good eye!

    What's with the emoticons appearing in the text. I didn't place them there, knowingly.


    - Herv
  4. Guiyon macrumors 6502a

    Mar 19, 2008
    North Shore, MA
    You need to enclose your code with
     tags otherwise the forum will try to interpret the various parens, brackets, etc.

Share This Page