I am having an issue with PKRevealController code from GitHub crashing my app. I set it up right:
WebViewController *rightView2 = [[WebViewController alloc] initWithNibName:@"WebViewController" bundle:[NSBundle mainBundle]];
PKRevealController *revealController = [PKRevealController revealControllerWithFrontViewController:tabBarController leftViewController:rightView2];
revealController.delegate = self;
window.rootViewController = revealController;
[window makeKeyAndVisible];
And in the viewController I want to call it from I add this:
- (void)startPresentationMode
{
if (![self.revealController isPresentationModeActive])
{
[self.revealController enterPresentationModeAnimated:YES completion:nil];
}
else
{
[self.revealController resignPresentationModeEntirely:NO animated:YES completion:nil];
}
}
When I click the button to start that code, it slides over and shows the view just how I want it. Clicking outside of the side view even slides it back. But, if I click the button again, I simply get a (lldb) crash in console. If I add an exception breakpoint, it shows me a line in PKRevealController:
NSAssert([self hasLeftViewController] || [self hasRightViewController], @"%@ ERROR - %s : Cannot enter presentation mode without either left or right view controller.", [self class], __PRETTY_FUNCTION__);
What is exactly the problem going on?