Search code examples
iphoneiosuinavigationcontrolleruinavigationitempopviewcontrolleranimated

UINavigationController popViewControllerAnimated issue


I have LoginViewControllerIphone instance , where I push the instance of TasksRootViewControllerIphone

then in TasksRootViewControllerIphone (10 seconds after appearing) I call [self.navigationController popViewControllerAnimated:YES];

And receive an error:

[NSRecursiveLock isSystemItem]: unrecognized selector sent to instance 0x3ba360

I tried to print navigation controller stack:

po [self.navigationController viewControllers]
$2 = 0x003445f0 <__NSArrayI 0x3445f0>(
<LoginViewControllerIphone: 0x3b73c0>,
<TasksRootViewControllerIphone: 0x3af290>
)

So it has proper view controllers. Any ideas how can it happen?

update:

pushing code:

           self.tasksRootViewControllerIphone = [[TasksRootViewControllerIphone alloc] initWithNibName:@"TasksRootViewControllerIphone" bundle:nil];
            self.tasksRootViewControllerIphone.view.backgroundColor = [UIColor clearColor];
            [self.loginViewControllerIphone.navigationController pushViewController:self.tasksRootViewControllerIphone animated:YES];

in TasksRootViewControllerIphone.m I have:

- (void)viewDidLoad
{
    [self performSelector:@selector(popCurrentViewControllerAnimated) withObject:self afterDelay:10];
}

- (void)popCurrentViewControllerAnimated
{
    [self.navigationController popViewControllerAnimated:YES];
}

Solution

  • I found the point.

    The problem was because it's not arc project, and one of the UIBarButtonItems was released one time more.

    Strange, but it caused the problem with popViewController.