title: Access Current ViewController Class Name from AppDelegate.m
body: <p>How if I wanted to access the current view controller instead of the root view controller to get the class name from AppDelegate.m?</p>
  
  <p>Currently, ViewController A is actually the root view of RootViewController.</p>
  
  <p>I've did some research here but I only managed to get the RootViewController class name instead of ViewController one.</p>
  
  <p><a href="https://stackoverflow.com/questions/13409009/nslog-of-the-current-viewcontroller-class-name-from-appdelegate-m">NSLog of the current ViewController class name from AppDelegate.m</a></p>
  
  <p>I've followed what the answers that provided for the question, but it returns null for
  self.</p>
  
  <pre><code>NSLog(@"Current View Controller Class Name: %@", self.window.rootViewController.navigationController.visibleViewController.class);
  </code></pre>
  
  <p>or</p>
  
  <pre><code>NSLog(@"Current View Controller Class Name: %@", [self.window.rootViewController.navigationController.visibleViewController class]);
  </code></pre>