I've used UISplitViewController several times before without problems (well, problems that I've fixed anyway ;-) However, I have always previously used a UITableView as the master view, as that's the obvious choice. Today I have need for something a little different, so I'm just providing a UIView.
However, I'm getting the exception,
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "MyViewController" nib but didn't get a UITableView.'
I can't find mention in the Apple documentation that the master view must always be a UITableView in the documentation, there's just a reference to the master view being used to display a list.
Is there a rule that the master view must always be a UITableView?
No, it doesn't.
I'd made a mistake by changing the code for the iPad idiom, but testing on an iPhone - whoops!
Related
I am making an iPad app that, among other things contain a view in which to set options.
This "Options" View has two container-views, each holding a TableView with two different kinds of options in them, and switches to turn these options on or off.
The problem is that when I try to make a button from my main ViewController that will open the options view, I get the following error:
Screenshot of signal SIGABRT error
with this in the output:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] instantiated view controller with identifier "UIViewController-c2d-Su-6Id" from storyboard "Options", but didn't get a UITableView.'
I don't know why the underlying function [UITableViewController loadView] is used, as I do not expect my Options-view to be a TableView - the tables are in container views.
I am using different storyboards, and a segue to a storyboard reference to present the Options View modally. I have tried deleting both the button, the segue and the Storyboard reference, replacing them with new ones, and renaming my ViewController.swift file, and all the references to it, with no luck
I have also tried looking for other solutions here on the site, but I have had no luck, and I begin to fear it might be because of the tableViews in the containerViews...
I am quite new to learning swift and Xcode, so please keep your explanations simple to follow, and assume that I am completely incompetent :-)
I'm guessing you probably added a Container View, which automatically places a "child" view controller onto the Storyboard, and then simply changed the Class of that child VC to UITableViewController --- which, as you found out, doesn't work.
To use a table view controller as the child, add your Container View, then add a normal UITableViewController to the Storyboard. Then, Ctrl-Drag from the Container View to the new table view controller and select Embed from the popup menu.
I'm still new to objective -c. I have everything else working but I just can't wrap my head around this login screen atm.
I can log in but after that, my app crashes and I get this error:
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'
But without the login screen, it works fine. My storyboard looks like this:
Could someone lend a hand?
The problem is not really inside your login screen, but in the MasterViewController. With some breakpoints, you should see that your present controller is allocated, it's viewDidLoad is probably called.
But inside some method of the tableView's delegate implementation (probably cellForRowAtIndexPath:) your code crashes. Make sure to have a correct implementation of the tableView's methods, using a identifier for cell in your XIB/Storyboard (or registering with registerClass:forCellReuseIdentifier: method ,etc.
This link should help you with the problem: Why am I getting an error about being unable to dequeue when my UITableView tries to load?
I'm trying to implement (what I thought would be) a straightforward, full-screen, four-pane iPad app interface by using container views. I have a simple root UIViewController containing a single view, in which are four container views, each with an embedded view controller (two panes each having a UITableViewController, and two panes each having a UIViewController). This was a breeze to create in Interface Builder, but when I run the app I get the following errors, apparently when the first embed segue is performed (i.e., after prepareForSegue is called with the embed segue for one of the two UITableViewControllers, but, apparently, before viewDidLoad is actually called on that UITableViewController):
* Assertion failure in -[UIStoryboardEmbedSegue perform], /SourceCache/UIKit_Sim/UIKit-2380.17/UIStoryboardEmbedSegue.m:18
* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'containerView is required.'
Has anyone got a clue what I'm doing wrong? I can't seem to find any mention of this "containerView is required" error anywhere.
Thanks!
Well, I figured it out, and it had nothing to do with container views. Rather, I was inadvertently reusing a navigation controller subclass that I developed for the iPhone version of the app as the root view controller of the iPad version; and since a navigation controller does of course need a container view (which the root view controller in the iPad version does not have), it resulted in the error given. I'm leaving this up here in case anyone else encounters this rather cryptic error and made the same mistake I did!
In storyboards using a static content tableview. I've added a tableview cell. In it I've added a view and a label. When I assign the view as the cell's backgroundView (ctrl+click & drag from the cell to the view) I get the following error at run after loading the tableview.
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. UITableViewCell's implementation of -layoutSubviews needs to call super.'
If I remove the association, it runs without issue.
Has anyone had any experience with this error?
I'm going to make a guess that is the one rare time where a view is treated as being included twice in a view hierarchy. When layout is performed, it goes through the normal view heir achy and lays out the view, but then (or before that) it lays out the background view hierarchy as well. This would HAVE to result in a layout error.
The solution? Growl at apple and ignore it. Disconnect the view from the backgroundView property and just deal with it as a view. This works for me. I don't see any great advantage in connecting it.
I get this log on the console:
* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController
_loadViewFromNibNamed:bundle:] loaded the "AboutView" nib but the view outlet was not set.'
...when I instantiate a custom UINavigationController subclass, with a root view controller (of class AboutViewController) and try to present it modally.
I do have an AboutViewController, but it creates its view programatically. There is no such thing as an AboutView class or associated xib file. In fact, there is not a single nib/xib file in the whole project.
I've seen this question asked several times here, but always by people using Interface Builder (not my case, hence no solutions apply).
NOTE: This happens only with the 5.0 Simulator; 6.0 Simulator, Device running 5.0.1, 6.0 have no problem...
What's going on?