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!
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 following the SwiftExample from JSQMessagesViewController but attempting to place the ChatViewController into a container view controller. It works as expected except that the text input toolbar does not show at the bottom.
I have experimented with sizing and looking at the hierarchy debug view to see if the input toolbar may be hidden offscreen, but it does not appear to exist. The toolbar is part of the JSQMessagesViewController xib file. Why would it not show?
UPDATE:
I see that jsq_configureMessagesViewController explicitly removes the inputToolbar from the view. If I comment out that line as an experiment I get the toolbar to appear, however it then fails with an error regarding having the wrong parent in the view hierarchy.
So obviously there are things I do not yet understand about input views and the view hierarchy. This thread seems related:
Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency',
and for what it's worth here is my storyboard showing the container:
Storyboard diagram
The problem seems to be unique to the current development branch. Reverting to an earlier release seems to work.
I have been at this for sometime now and all I can find is simple Segues via google. I will do my best to show you what I am trying to do and provide snapshots as to what I am doing.
The middle controller is a simple segue to the map. It will be the root. I created a new file "Cocoa Touch Class"
Now I created a IBOutlet to the "Cocoa Touch Class" I just created for the map.
Now I get an error:
libc++abi.dylib: terminating with uncaught exception of type
NSException
Am I adding the controllers incorrectly? I am not sure what I am doing wrong.
The root or "Home" will send the user to many different pages depending on what they press. From my understanding user each page will be its own view like I am trying to do above. However I feel I am doing something wrong, I am just not sure what it is.
I think it's because in storyboard you have created UIViewController and attached it to UITableViewController. Try change Base class for your controller from UITableViewController to UIViewController.
I'm new to view controllers with OpenGL, but I want to present a view controller with two child view controllers (the user only sees the two child view controllers) which both display some graphics using OpenGL.
I have no idea why what I'm doing is not working. This is hard to describe in code, as there really isn't any, but I've got a Storyboard where I have my initial UIViewController, two container views each taking up half the vertical space, which then point to each of their UIViewControllers that have a GLKView making up the main view.
I don't even have any code yet, but whenever I run it, the app opens and then immediately crashes stating:
* Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named GLKView'
Here's a sample project where it's failing: http://speedyshare.com/v8YCy/download/GLTest.zip
How do I accomplish OpenGL-based view controllers as child view controllers?
I didn't download your project, but the problem is almost certainly that you didn't add the GLKit framework to your project. Go to your project's settings (the blue icon at the top of the project navigator) and scroll to the bottom ("Linked Frameworks and Libraries"), and click the "+" button. You can add the framework from there.
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!