Reputation: 747
I've got a method that does [self.tableView reloadData]
but I'm getting the error Property 'tableView' not found on object of type 'JSONTableViewController *'
.
If I make my interface a UIViewController, this happens, but if I make the interface a UITableViewController, then I don't get the error.
However, if I make it a UITableViewController and switch focus onto the table in the app, I get the error Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "Y4P-9F-EJw-view-lhp-ew-nTw" nib but didn't get a UITableView.'
I've been trying to fix this issue for ages now, but I can't figure out a solution.
Upvotes: 0
Views: 1909
Reputation: 89509
UITableViewController has a "tableView
" property. UIViewController does not have a tableView
" property.
If you want a "tableView
" property using a UIViewController, you'll need to add one yourself.
E.G.
@property (strong) IBOutlet UITableView *tableView;
Be sure to connect the table view in your storyboard or xib to the "tableView
" property.
Upvotes: 3
Reputation: 11211
I've got a method that does [self.tableView reloadData] but I'm getting the error Property 'tableView' not found on object of type 'JSONTableViewController *'.
The error appears because you don't have any property named tableView
in your interface..
If I make my interface a UIViewController, this happens, but if I make the interface a UITableViewController, then I don't get the error.
That goes fine because UITableViewController
has a tableView
propery, see here.
However, if I make it a UITableViewController and switch focus onto the table in the app, I get the error Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "Y4P-9F-EJw-view-lhp-ew-nTw" nib but didn't get a UITableView.'
Please see this answer, you don't have any outlet linked to a tableView
property.
You should take a look over a Table View sample implementation.
Upvotes: 2
Reputation: 94723
You have got a nib file for that view controller who's view is a plain view instead of a table view. Also, a normal UIViewController does not have a tableview property automatically. You have two options:
Leave the view controller a subclass of UITableViewController and modify the nib so the "view" outlet on the "File's Owner" points to a UITableView OR just delete the xib file (you would have to do any table view customization in code).
Make you view controller a subclass of UIViewController and create your own tableView outlet. Add a table view as a subview in your nib and connect it to the newly created tableView outlet. In this case you will also have to manually set the delegate and datasource of the table view.
Upvotes: 0