views:

80

answers:

2

I've been hitting this bug that I don't know what is wrong. When I debug this code and it hits here the program will lock up when it hit the addSubView line and says

terminating_due_to_uncaught_exception

I'm not sure if I'm forgetting something in interface builder or what but the codes does compile.

ViewTypeView is the View's controller class that I am trying to change to.

viewTypeView is the name of the class

   -(void)flipToTypeFromMain
{

    ViewTypeView * aTypeView = [[ViewTypeView alloc] initWithNibName:@"TypeView" bundle:nil];
    [self setViewTypeView:aTypeView];
    [aTypeView release];

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:2.0];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:window cache:YES];
    [viewController.view removeFromSuperview];

//Stops here    
[self.window addSubview:[viewTypeView view]];
    [UIView commitAnimations];
}
+1  A: 

You can set a breakpoint on objc_exception_throw to see what is causing the issue. This is discussed in the "Breaking on Exceptions" section here: http://www.cocoadev.com/index.pl?DebuggingTechniques

This will let you see the callstack that is causing the exception to be raised.

nall
A: 

You weren't too clear. Is viewTypeView a class name? The following line of code:

[self.window addSubview:[viewTypeView view]];

shows an object called viewTypeView. Is that defined anywhere or are you incorrectly using a class name instead of an object?

mahboudz