iOS-Slide-Menu icon indicating copy to clipboard operation
iOS-Slide-Menu copied to clipboard

Crash on push after poptoroot

Open madsodgaard opened this issue 10 years ago • 0 comments

I have a left menu, with a logout button, which goes back to the login screen.

On the login screen it performs a push segue to the next screen "SearchViewController"

Then when I press "Logout" and try to push another view it crashes with this:

SearchViewController respondsToSelector:]: message sent to deallocated instance 0x7ffbed05fb90

UIViewController *vc;

if(indexPath.section == 0) {
    switch (indexPath.row) {
        case 0: {
            if(superuser)
                vc = [storyboard instantiateViewControllerWithIdentifier:@"SearchViewController"];
            else
                vc = [storyboard instantiateViewControllerWithIdentifier:@"myServersViewController"];
            break;
        }
        case 1: {
            vc = [storyboard instantiateViewControllerWithIdentifier:@"myServerViewController"];
            break;
        }
        case 2: {
            vc = [storyboard instantiateViewControllerWithIdentifier:@"ConsoleViewController"];
            break;
        }
        case 3: {
            vc = [storyboard instantiateViewControllerWithIdentifier:@"CommandsViewController"];
            break;
        }
        case 4: {
            vc = [storyboard instantiateViewControllerWithIdentifier:@"SchedulesViewController"];
            break;
        }
        case 5: {
            vc = [storyboard instantiateViewControllerWithIdentifier:@"BackupViewController"];
            break;
        }
    }
}
if(indexPath.section == 2) {
    if(indexPath.row == 0) {
        manager.currentServerID = -1;
        [manager.activeUserInformation removeAllObjects];

        [[SlideNavigationController sharedInstance] popToRootViewControllerAnimated:YES];
    }
}

[[SlideNavigationController sharedInstance] popToRootAndSwitchToViewController:vc withSlideOutAnimation:YES andCompletion:nil];

madsodgaard avatar Aug 07 '15 14:08 madsodgaard