ios - Application quits *** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:] -


this code uitableview. whenever load view, recieve following error:

*** assertion failure in -[uitableview _configurecellfordisplay:forindexpath:], /buildroot/library/caches/com.apple.xbs/sources/uikit_sim/uikit-3512.30.14/uitableview.m:7962 uitableview (; layer = ; contentoffset: {0, 0}; contentsize: {343, 190}>) failed obtain cell datasource ()

the method create table same. have been working tableviews long time. however, wasn't able figure out that's wrong this.

- (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     return 1; }  - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     return 3; }  - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath{     switch (indexpath.row) {         case 0:             return 70;             break;         case 1:             return 50;             break;         case 3:             return 50;             break;         default:             return 70;             break;     } }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     static nsstring *id = @"cellid2";     uitableviewcell * cell = [tableview dequeuereusablecellwithidentifier:id forindexpath:indexpath];     if(cell == nil)     {         cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:id];     }      uilabel *object = (uilabel *)[cell.contentview viewwithtag:1];     uilabel *discription = (uilabel *)[cell.contentview viewwithtag:2];     object.text = [array objectatindex:indexpath.row];      switch (indexpath.row) {         case 0:             discription.text = self.location;             break;         case 1:             discription.text = self.locationtype;             break;         case 3:             discription.text = self.rating;             break;         default:             break;     }      return nil; } 

the message:

failed obtain cell datasource

means returning nil cellforrowatindexpath method.

change return nil; return cell; @ end of cellforrowatindexpath method.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -