Attempt to present UIViewController on UIViewController whose view is not in the window hierarchy

Where are you calling this method from? I had an issue where I was attempting to present a modal view controller within the viewDidLoad method. The solution for me was to move this call to the viewDidAppear: method. My presumption is that the view controller’s view is not in the window’s view hierarchy at the point that it has been loaded … Read more

UITableView example for Swift

The example below is an adaptation and simplification of a longer post from We ❤ Swift. This is what it will look like: Create a New Project It can be just the usual Single View Application. Add the Code Replace the ViewController.swift code with the following: Read the in-code comments to see what is happening. The highlights are The … Read more

Attempt to present UIViewController on UIViewController whose view is not in the window hierarchy

Where are you calling this method from? I had an issue where I was attempting to present a modal view controller within the viewDidLoad method. The solution for me was to move this call to the viewDidAppear: method. My presumption is that the view controller’s view is not in the window’s view hierarchy at the point that it has been loaded … Read more

Xcode – How to fix ‘NSUnknownKeyException’, reason: … this class is not key value coding-compliant for the key X” error?

Your view controller may have the wrong class in your xib. I downloaded your project. The error you are getting is ‘NSUnknownKeyException’, reason: ‘[<UIViewController 0x3927310> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key string.’ It is caused by the Second view controller in MainWindow.xib having a class of UIViewController instead of SecondView. Changing to the correct class resolves the … Read more