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.
Question
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 2
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.
OTHER TIPS
Update your viewDidload Method as
- (void)viewDidLoad
{
[self performSelector:@selector(popCurrentViewControllerAnimated) withObject:nil afterDelay:10];
}
hopefully it solve your problem.
As the method popCurrentViewControllerAnimated
not take any argument. so withObject
should be nil
. not self
.