I'm betting tableViewController
isn't really a TableViewController
. Put a breakpoint at this line of code:
tableViewController.parent = self;
...then in the debugger window, type the following:
po tableViewController
po means "print object". You should see something like this:
<TableViewController: 0x100615120>
If instead it looks something like this:
<UITableViewController: 0x100615120>
...then that's your problem. If so, then navigationController.viewControllers[0]
isn't the right class. Look at where in the code (or storyboard) that is set up.