1

I am trying to run a simple Table View app in swift with the iOS simulator. But the app crashes once the simulator starts.

Here is my code:

import UIKit

class ViewController: UIViewController, UITableViewDataSource,UITableViewDelegate {

    var restaurantNames = ["Cafe Deaden", "Home 1", "Teakha", "cafe Loisal","petite Oyster","For Kee Restaurant","pos Atelier","Bourke Street Bakery", "Haigh's Chocolate"]

    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 cellIdentifier = "Cell"
            let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath:
            indexPath) as UITableViewCell
            // Configure the cell...
            cell.textLabel!.text = restaurantNames[indexPath.row]
            return cell
    }
}

It says thread 1 breakpoint 1.5 in var restaurantNames.I have no idea where to start troubleshooting. Any help would be great.

Thanks and Cheers

1
  • It help if you add the *full error message. Next up: readdup on using the Xcode debugger, the more you know about Xcode and the debugger the easier developing code wil be. Commented Sep 5, 2015 at 19:08

1 Answer 1

3

It's not a crash, you just have a breakpoint there.

Go to Debug -> Deactivate Breakpoints

Here's some Apple Documentation on breakpoints

https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/Creating,Disabling,andDeletingBreakpoints.html

Sign up to request clarification or add additional context in comments.

1 Comment

Oh Cool! That fixed it for me. Thank you so much! Kind of feeling stupid at the moment :-D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.