I have to include the leah pulltorefresh table view in an existing ios project. (https://github.com/leah/PullToRefresh)
The existing table view is defined in a xib file and it's linked to an outlet in the controller class (a subclass of UIViewController).
My first try was to make the controller inherit of PullToRefreshTableViewController (from leah's project) and add the refresh fonction in that same controller. But it doesn't work, I have this error :
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "CampaignViewController" nib but didn't get a UITableView.'
Since PullToRefreshTableViewController is a subclass of UITableViewController, I think I can't make my controller inherit from it (am I right?). How can I do this? Thanks
Try creating TableViewController from scratch, making it a subclass of PullToRefreshTableViewController.
It's much simpler than creating a table view in IB, connecting outlets, and then filling all necessary delegate and datasource methods.
Related
I have a problem similar to this:
UITableViewController inside a UIViewController
I follow exactly the same steps.
I have a UIViewController with my custom class: MyCustomClassViewController and UITableViewController named MyCustomUITableViewController.
Inside of my ViewController I added a Container View and drag and drop to my UITableView and selected embed.
Ok, now, when I executed the project, I got this error:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'containerView is
required.'
Your view controller classes are incorrectly constructed. Look at your embed segue, and make sure that:
The source view controller is marked in the identity inspector as MyCustomClassViewController
The destination view controller is marked in the identity inspector as MyCustomUITableViewController
Also go back to your code and make sure also that you have the correct inheritance:
MyCustomClassViewController should be a UIViewController subclass
MyCustomUITableViewController should a UITableViewController subclass
You might even have to delete the segue, and even the view controllers, from the storyboard, and recreate them along with the container view and the embed segue.
All,
I have a ViewController with a TableView in it. In the Tableview I have a prototype cell designed and it has a subclass and its subclassed with PFTableViewCell.
As I have a view controller and a tableview in it, I have created this class on my view controller.
class ViewController: PFQueryTableViewController {
but as its not a tableviewcontroller will PFQueryTableViewController work ? As I am getting horrible errors like :
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "vXZ-lx-hvc-view-kh9-bI-dsS" nib but didn't get a UITableView.'
Any ideas guys ? I need it as a ViewController because there are other things on the screen besides just a TableView.
You can add a container to your UIViewcontroller in your storyboard. It will create a UIViewController automatically. But you can delete it and add your PFQueryTableViewController instead.
After that you can right click(and hold) from the container to your PFQueryTableViewController and connect the both components and choose embed.
I am trying to add a search feature to my app but the screen needs to have a navigation bar in addition the search bar on the UITableView. I am getting the following error when i perform the segue (click a button) and the view loads
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "2Gx-ec-tTH-view-HBf-bD-79u" nib but didn't get a UITableView.'
Here is what it looks like on my storyboard.
I believe the problem is that this scene is managed by a class called "AllDataViewController" and it manages the UIView and is a subclass of UITableView it is actually PFQueryTableViewController
//AllDataTableViewController.h
#interface AllDataTableViewController : PFQueryTableViewController <UISearchDisplayDelegate, UISearchBarDelegate, UITableViewDelegate>
So I am not sure what I am doing wrong here. But let me know if you have any suggestions or if I need to add any more information.
Because your view controller subclasses UITableViewController (well, indirectly via PFQueryTableViewController), it expects its view property to refer to an instance of a UITableView. If you look at the object hierarchy in the storyboard scene I think you will find that the root of the scene is not a UITableView, but a UIView.
How did you add the navigation bar? The correct method is to select "embed in..." from the Editor menu in Image Builder.
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.
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.
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.
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.
I'm trying to subclass UITableViewController just with just code without a nib or storyboard. Upon loading its view I get this error:
'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "BYZ-38-tfr-view-1bC-Xs-vdC" nib but didn't get a UITableView.'
I've tried setting self.tableView with a new table view in :loadView but that doesn't fix it, nor does setting it in any initializers. Any solutions?
Edit: The class is a plain subclass of UITableViewController generated from the "new file" menu. No customizations have been made.
It may help to note that the project itself has a storyboard, and I'm loading the UITableViewController subclass by making the app's starting view controller to be the subclass.
The error is easily reproducible by creating a new single-view template project in Xcode, generating a plain UITableViewController subclass, and setting the only view controller in the storyboard to be of the UITableViewController subclass type.
Edit 2: Problem solved, check comments.
I fixed it by avoiding any storyboard whatsoever. Originally I had it being loaded via the projects main storyboard. Instead, I now load up the subclass instance in a separate view controller, avoiding the error.