PDA

View Full Version : terminating uncaught exception




italiano40
Feb 21, 2009, 08:05 PM
ok i keep getting that message on the debugger, and i have developed on Cocoa for mac OSX never for the iphone but for catching the exception i used try{
//code

}
@catch(NSException *e){
@throw e;
}
how can i find out what line of code is causing a exception?



eddietr
Feb 21, 2009, 09:22 PM
In most cases the exception itself should tell you enough to narrow it down. That's usually the quickest way. What is the exception?

Or, if that's not enough, you can set breakpoints for exceptions like this:


fb -[NSException raise]
fb objc_exception_throw


either in your .gdbinit or manually from gdb or the XCode interface. Then you can look at the stack trace for exactly where the exception is being thrown.

BTW, this is exactly the same as you would do in a Mac application. So the same techniques you used previously with the Mac will work here.

Hope that helps.