Nsexception * Ex = [[nsexception alloc] initwithname: @ "exceptionname" // just for test reason: @ "XXX" userinfo: Nil]; // customnsexception * Ex = [[customnsexception alloc] initwithname: @ "customnsexceptionname" // just for test // reason: @ "XXX" // userinfo: Nil]; // @ try {bool error = yes; If (error) {@ throw ex ;}/// @ catch (mnmnsexception * exception) {// nslog (@ "mnmnsexception. name = % @ ", customnsexception. name); // nslog (@ "mnmnsexception. reason = % @ ", customnsexception. reason); ///// a warning box is displayed, indicating the exception. // uialertview * Alert = [[uialertview alloc] initwithtitle: customnsexception. name // message: customnsexception. reason // delegate: Nil // cancelbuttontitle: Nil // otherbuttontitles: Nil]; // [alert show]; // [alert release]; //} @ catch (nsexception * exception) {nslog (@ "exception. name = % @ ", exception. name); nslog (@ "exception. reason = % @ ", exception. reason) ;}@ finally {nslog (@ "@ finally ");}