Question: In delegate class I wrote the code as follows

```
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:     (NSDictionary *)launchOptions
{

 [self generateFirstScreen];
 [self removeFirstScreen]; // On login check implement this method or u can directly            write the snippet here as well.
[self prepareControllersOnTabs];  //your tab controller code function
[self.window makeKeyAndVisible];
return YES;
}
-(void) removeFirstScreen
{
[firstScreen removeFromSuperView];
self.window.rootViewController = self.tabBarController;
[firstScreen release];
}
-(void) generateFirstScreen
{ 
FirstScreen *firstScreen = [[FirstScreen alloc]init];
[self.navigationController pushViewController:firstScreen animated:YES];
[firstScreen release]; 
}

```

but generateFirstScreen works fine but removeFirstScreen gives an exception Please help me.

Answer: 
Don't remove a screen if you're not sure it's added to a view, otherwise you get a crash.. you can specify a tag to this view and check the subviews of the main view to check whether your view is in there somewhere..
```
your generateFirstScreen method Change like below
FirstScreen *firstScreen = [[FirstScreen alloc]initWithNibName:@"FirstScreen" bundle:nil];
navigationController = [[UINavigationController alloc] initWithRootViewController:self.objLogin];
        // Add the navigation controller's view to the window and display.
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];

//call this metod when ever u want tabbar
-(void)tabBarControllerView
{   [self.navigationController.view removeFromSuperview];
    [self.navigationController.view setHidden:YES] ;
    self.tabBarController.selectedIndex = 0;
    self.tabBarController.view.hidden=NO;
    [window addSubview:self.tabBarController.view];
}

```