Question: I am working application in which i calling `presentModalViewController` and once finished(calling `dismissModalViewControllerAnimated:YES`) it should immediately call `popToRootViewControllerAnimated`.

But the issue is `dismissModalViewControllerAnimated:YES` is working properly but `popToRootViewControllerAnimated`is not working after it.

The code is shown below:

```
[self.navigationController dismissModalViewControllerAnimated:YES] ;
[self.navigationController popToRootViewControllerAnimated:YES];

```

Answer: 
Try something like this:

```
[self.navigationController dismissModalViewControllerAnimated:YES] ;
[self performSelector:@selector(patchSelector) withObject:nil afterDelay:0.3];

-(void)patchSelector{
  [self.navigationController popToRootViewControllerAnimated:YES]; 
}

```

It is not so neat but it should work.

**UPDATE:**
You should use

```
 [self dismissModalViewControllerAnimated:YES];

```

instead

```
 [self.navigationController dismissModalViewControllerAnimated:YES] ;

```

The object that is presenting the modal is the view controller, not the navigation controller.
I guess, you are not calling the 

```
[self.navigationController popToRootViewControllerAnimated:YES];

```

in the target modal viewcontroller. check that.