2
votes

am using SLKTextViewController framework install with pods and it works fine until I try to edit the number of numberOfRowsInSection or numberOfSectionsInTableView or cellForRowAtIndexPath. Why ?

 class Feed: SLKTextViewController {



    override class func tableViewStyleForCoder(decoder: NSCoder) -> UITableViewStyle {
        return UITableViewStyle.Plain;
    }       
 override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        // #warning Incomplete implementation, return the number of sections
        return 1
    }

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of rows
        return data.count
    }


    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! FeedCell

    // Configure the cell...
        cell.textLabel?.text = data[indexPath.row]

    return cell

    }

Error :

2015-08-18 18:04:10.593[67777:4870181] * Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3505.4/UITableView.m:6540 2015-08-18 18:04:10.600[67777:4870181] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard' *** First throw call stack:

0   CoreFoundation                      0x00000001059839b5 __exceptionPreprocess + 165
1   libobjc.A.dylib                     0x00000001077abdeb objc_exception_throw + 48
2   CoreFoundation                      0x000000010598381a +[NSException raise:format:arguments:] + 106
3   Foundation                          0x0000000105ff6b72 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
4   UIKit                               0x000000010650232f -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] + 275
5                        0x00000001057adc08 _TFC144Feed9tableViewfS0_FTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 120
6                        0x00000001057addff _TToFC144Feed9tableViewfS0_FTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 79
7   UIKit                               0x00000001065140c6 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 782
8   UIKit              (
1

1 Answers

2
votes

You haven't neither registered a cell class nor registered nib file ; this is your problem. You can register cell class by:

self.tableView.registerClass(FeedCell.self, forCellReuseIdentifier: "cell")