title: Deleting a file from documents directory when going back in UINavigation
body: <p>I'm trying to delete a file in my Documents directory when the user presses back in a view with UINavigation. When I run my code go back then go back to the view, I get the following error and the app crashes:</p>
  
  <blockquote>
    <p>2014-07-28 18:19:42.446 App[13291:a0b] nested pop animation can result
    in corrupted navigation bar</p>
    
    <p>2014-07-28 18:19:42.798 App[13291:a0b] Finishing up a navigation
    transition in an unexpected state. Navigation Bar subview tree might
    get corrupted.</p>
  </blockquote>
  
  <p><strong>My Code</strong></p>
  
  <pre><code>-(void) viewWillDisappear:(BOOL)animated {
      if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) {
          // Navigation button was pressed. Do some stuff
          NSString *path = [[NSBundle mainBundle] pathForResource:_url ofType:@"plist"];
          NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:path];
  
          NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
          NSString *documentsDirectory = [paths objectAtIndex:0];
          NSString *temp = [documentsDirectory stringByAppendingPathComponent:[dict objectForKey:@"FolderName"]];
          [[NSFileManager defaultManager] removeItemAtPath: temp error:nil];
  
          [self.navigationController popViewControllerAnimated:NO];
      }
      [super viewWillDisappear:animated];
  }
  </code></pre>