title: [CustomViewController respondsToSelector:]: message sent to deallocated instance
body: <p>This is used to work fine for my pre-ARC code, but since refactoring all the project to be ARC compatible, I start getting this crash:</p>
  
  <pre><code>[CustomViewController respondsToSelector:]: message sent to deallocated instance
  </code></pre>
  
  <p>My project is an iPad app with a split view, but contrary to apple documentation, previous developer has put another view controller to be visible on app launch before split view. So I know this is not the right way to do, but as I said it used to work before ARC integration so I need to get a workaround with this.</p>
  
  <p>The root view controller which contain a menu of items, each item display a detail form to be filled, then a click on next button move to the next detail screen, etc.</p>
  
  <p>The issue starts when I click on home button put on root view to get back to the home view, here is the relevant code that move the user to the home screen:</p>
  
  <pre><code>//this method is in the appdelegate, and it gets called when clikc on home button located on the root view
  - (void) showHome
  {
      homeController.delegate = self;
  
      self.window.rootViewController = homeController;
      [self.window makeKeyAndVisible];
  }
  </code></pre>
  
  <p>Then when I  click on a button to get back to the split view (where are the root/details view), the app crashes with the above description. I profiled the app with instruments and the line of code responsible of that is located in the <code>RootViewController</code>, in the <code>didSelectRowAtIndexPath</code> method, here is the relevant code:</p>
  
  <pre><code>    if(indexPath.row == MenuCustomViewController){
              self.customVC=[[CustomViewController alloc] initWithNibName:@"CustomVC"
                                                                        bundle:nil];
              [viewControllerArray addObject:self.customVC];
              self.appDelegate.splitViewController.delegate = self.customVC;
  }
  </code></pre>
  
  <p><code>customVC</code> is a strong property, I tried to allocate directly and assign to the instance variable but that didn't help to fix the crash. Any thoughts ?</p>
  
  <p><strong>EDIT:</strong>
  Here is the stack trace given by instruments:</p>
  
  <pre><code>[self.appDelegate.splitViewController setViewControllers:viewControllerArray];//this line caused the crash
  
  [viewControllerArray addObject:self.appDescVC];//this statement is called before the above one
  
  self.custinfoVC=[[CustInfoViewController alloc] initWithNibName:@"CustInfo" bundle:nil];//this statement is called before the above one
  
  self.appDelegate.splitViewController.delegate = self.appDescVC;//this statement is called before the above one
  </code></pre>
  
  <p><code>custinfoVC</code> and <code>appDescVC</code> are strong properties.</p>