@try {
//Do something which might raise an exception
}
@catch (NSException *exception) {
//Handle the exception. E.g.: Show alert
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:[exception name]
message:[exception reason] delegate:self
cancelButtonTitle:@”Ok” otherButtonTitles: nil];
[alert dismissWithClickedButtonIndex:0 animated:TRUE];
[alert show];
[alert release];

//return;
}

Raise the exception by :

[NSException raise:name format:@"%@", reason];

Also has:

@finally

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2011 W2OM - iPhone by code Suffusion theme by Sayontan Sinha