0

I have declared a variable called restaurantNames and used an array to store the table data. When I run my program, I get an error Thread 1: Break point 1.3 but there's no highlighted errors on my code and also the TableView doesn't show the lines between rows it's just a blank page.

class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {

    var restaurantNames = ["Lucky WOK", "JFK", "Cafe11"]

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // return the number of rows in the section 

        return restaurantNames.count

    }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

        let cellIndentifier = "Cell"
        let cell = tableView.dequeueReusableCellWithIdentifier(cellIndentifier, forIndexPath: indexPath)

        // Configure the cell 

        cell.textLabel?.text = restaurantNames [ indexPath.row]

        return cell

    }

Picture

Output of the console:

UIKit-3512.29.5/UITableView.m:6547
2015-12-16 01:37:50.392 Dine-In[35796:238637] *** 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'
Katz
  • 826
  • 3
  • 19
  • 40
  • Even the table view's separators between empty rows are missing. Looks like your table view controller does not have its views set correctly...? – Nicolas Miari Dec 16 '15 at 06:27
  • 2
    The "error" message looks like execution is just stopping at one of your break points. Did you try resuming? Or disabling break points? – Nicolas Miari Dec 16 '15 at 06:30
  • See this: [iOS app breakpoints on running](http://stackoverflow.com/questions/14821587/ios-app-breakpoints-on-running) or this: [Xcode + remove all breakpoints](http://stackoverflow.com/questions/1665744/xcode-remove-all-breakpoints). – Martin R Dec 16 '15 at 06:32
  • first check whether you have given the delegate and data source to the table view in the storyboard and in the swift file where you are using the table view. – Arpit Dhamane Dec 16 '15 at 06:36
  • now the error moved to the AppDelegate I get `Thread 1: signal SIGBAT` @MartinR – Katz Dec 16 '15 at 06:37
  • Setting a breakpoint is not an error, that is something that *you* (deliberately or not) did. – Please update your question with the relevant information: Exact full error message, stack backtrace etc. – Martin R Dec 16 '15 at 06:39
  • yes I gave a `datasource` & `delegate` to the Table View @ArpitDhamane – Katz Dec 16 '15 at 06:39
  • @MartinR I updated the question with the new console output. – Katz Dec 16 '15 at 06:42
  • @FrancescStudio your cell is on storybroard? – vien vu Dec 16 '15 at 06:48
  • 2
    Please search for the error message "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", there are lots of similar questions. – Martin R Dec 16 '15 at 06:51
  • Thank you for the help @MartinR The problem was I didn't set the identifier of the cell to be the the same as the `Let cellIdentifier` declaration I made. – Katz Dec 16 '15 at 06:53
  • Looks like [this answer](http://stackoverflow.com/a/14939860/377369) will answer your question. – Fabio Poloni Dec 16 '15 at 07:30

0 Answers0