title: UITabBarController throws EXC_BAD_ACCESS
body: <p>I create a tab bar controller in the app delegate. Here is the .h and .m file:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface appAppDelegate : NSObject &lt;UIApplicationDelegate&gt; {
  UIWindow *window;
  UITabBarController *tabBar;
  }
  
  @property (nonatomic, retain) IBOutlet UIWindow *window;
  @property (nonatomic, retain) UITabBarController *tabBar;
  
  @end
  </code></pre>
  
  <p>here is the relevant function in the m file:</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
  
  UINavigationController *localNav;
  
  tabBar = [[UITabBarController alloc] init];
  NSMutableArray *controllerArray = [[NSMutableArray alloc] initWithCapacity:2];
  
  FirstViewController  *firstViewController = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
  localNav = [[UINavigationController alloc] initWithRootViewController:FirstViewController];
  localNav.navigationBar.tintColor = [UIColor blackColor];
  
  [controllerArray addObject:localNav];
  
  [firstViewController release];
  
  SecondViewController *secondViewController;
  secondViewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
  localNav = [[UINavigationController alloc] initWithRootViewController:secondViewController];
  [controllerArray addObject:localNav];
  [localNav release];
  [SecondViewController release];
  
  tabBar.viewControllers = controllerArray;
  
  [controllerArray release];
  [localNav release];
  
  [window addSubview:tabBar.view];
  
  [self.window makeKeyAndVisible];
  
  return YES;
  }
  </code></pre>
  
  <p>I changed the variable names (ie the first view is not called first view controller). The app will load and show two tabs that I can choose between. The issue comes in when I try to show a modal popup. I have a button that when pressed should show the modal.</p>
  
  <p>Here is the .h file. The custom button just rounds the corners of the button, other than that it is a straight extension of UIButton. The delegate just has functions for two buttons that are ok or cancel.:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import "CustomButton.h"
  #import "StartModal.h"
  #import "CurrentEntry.h"
  
  @interface FirstViewController : UIViewController &lt;StartModalDelegate&gt;{
  CustomButton *startEntry;
  
  }
  
  @property (nonatomic, retain) IBOutlet CustomButton *startEntry;
  
   - (IBAction) startLogEntry;
   - (void) locationSelection;
  
  - (void) dismissHandler;
  - (void) saveHandler;
  </code></pre>
  
  <p>@end</p>
  
  <p>The EXC_BAD_ACCESS comes in when I run the function for the button press. Here is the .m file:</p>
  
  <pre><code>- (IBAction) startLogEntry {
  NSLog(@"start the entry here");
  
  StartPoopModal *modal = [[StartModal alloc] initWithNibName:@"StartModal" bundle:nil];
  [modal setDelegate:self];
  
  UINavigationController *localNav;
  localNav = [[UINavigationController alloc] initWithRootViewController:modal];
  localNav.navigationBar.tintColor = [UIColor blackColor];
  [self.tabBarController presentModalViewController:localNav animated:YES];
  [modal release];
  }
  </code></pre>
  
  <p>the [self.tabBarController presentModalViewController....] is what throws the error. This has worked in the past and for some reason it is throwing an error. As far as I know I haven't changed it. I don't have this in any form of version control so I cannot double check it. </p>