When adding another view controller’s view as a subview, you should implement the custom container calls, addChildViewController and didMoveToParentViewController. BTW, the eliminates your need to maintain your own strong reference to that view controller.
Fix a few leaks and perform casting to avoid warning