SOXO
SOXO

Reputation: 11

Why am I getting an NSInternalInconsistencyException exception on my UITableView?

UPDATE It turns out that my renaming of my project causes these issues to happen :. I followed all these steps (How do I completely rename an Xcode project (i.e. inclusive of folders)?). I removed all my Outlets and I'm still getting the error so I still don't know what exactly is causing this to happen. For now I'm just going to revert to my previously named project and go from there. If you have any other rec's I'd appreciate them!

I'm simply trying to run my app but I get an "NSInternalInconsistencyException" exception saying that my view controller didn't get a UITableView.

I checked that my IBOutlet from my UITableView is set correctly but I'm still receiving the error..

This is how I'm declaring my IBOutlet...

class EntryViewController: SwipeTableViewController, UITextFieldDelegate {

    //MARK - IBOUTLETS

    @IBOutlet weak var entryTableView: UITableView!

    @IBOutlet weak var entryTextField: UITextField!
    @IBOutlet weak var saveButton: UIButton!
    @IBOutlet weak var heightConstraint: NSLayoutConstraint!
    @IBOutlet weak var searchBar: UISearchBar!

This is the error I'm getting:

Screenshot

* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: **'-[UITableViewController loadView] instantiated view controller with identifier "showEntries" from storyboard "Main", but didn't get a UITableView.'

libc++abi.dylib: terminating with uncaught exception of type NSException

I imagine this would link my UITableView to my ViewController.

Also, I'm subclassing a view named SwipeTableViewController from my EntryViewController...

class SwipeTableViewController: UITableViewController, SwipeTableViewCellDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()
        tableView.rowHeight = 80
    }

Wouldn't my EntryViewController be automatically subclassed to the UIViewController from there?

Upvotes: 1

Views: 809

Answers (2)

Devendra Agnihotri
Devendra Agnihotri

Reputation: 253

Do below steps. 1.Delete all outlets from storyboard. 2.Create a class of type UIViewController. 3.Drag and drop a new tableview to the storyboard. 4.Connect all the outlets with respective UI Elements.

Or you need to make your class as UITableViewController type.

Now It will not crash.

Upvotes: 0

Teja Nandamuri
Teja Nandamuri

Reputation: 11201

Looks like you have UITableView outlet declared in UITableViewController. Make sure your class is a subclass of UIVIewController instead of UITableViewController.

In your storyboard, look for the view controller with identifier "showEntries" , delete it, and drag the UIViewController element instead of UITableViewController element.

Then drop the UITableView into the UIViewController and connect it to the tableview outlet property in your view controller.

Upvotes: 1

Related Questions