ios - NSInternalInconsistencyException : must register a nib or a class for the identifier or connect a prototype cell in a storyboard -
i know question being asked many times i've gone through questions not able figure out whats wrong in case
my error message :
terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'unable dequeue cell identifier postcell - must register nib or class identifier or connect prototype cell in storyboard' *** first throw call stack: (0x1823f6db0 0x181a5bf80 0x1823f6c80 0x182d7c154 0x1876ddbf0 0x193b51ccc 0x10009b474 0x10009b50c 0x1878ab030 0x1878ab198 0x18789a298 0x1878afc64 0x1876408c4 0x1875501e4 0x184ee2994 0x184edd5d0 0x184edd490 0x184edcac0 0x184edc820 0x187552ff4 0x1823ad09c 0x1823acb30 0x1823aa830 0x1822d4c50 0x183bbc088 0x1875be088 0x10009aefc 0x181e728b8) libc++abi.dylib: terminating uncaught exception of type nsexception (lldb)
here's tableview 5 static cells can see cell's identifier set postcell
, assigned class tableviewcell
tableviewcell
class :
class tableviewcell: uitableviewcell { override func awakefromnib() { super.awakefromnib() // initialization code } override func setselected(selected: bool, animated: bool) { super.setselected(selected, animated: animated) // configure view selected state } }
tableviewcontroller
class :
class posttableviewcontroller: uitableviewcontroller { override func viewdidload() { super.viewdidload() } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } // mark: - table view data source override func numberofsectionsintableview(tableview: uitableview) -> int { // #warning incomplete implementation, return number of sections return 1 } override func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { // #warning incomplete implementation, return number of rows return 5 } override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("postcell", forindexpath: indexpath) as! tableviewcell return cell } }
this frustrating trying figure last night , if knows whats wrong or missing please let me know
if want able dequeue cell instances , modify them must use prototype cells, not static cells. each cell must have unique reuse identifier.
Comments
Post a Comment