PHP Module

Home Cocoa tips Catching Exceptions
Catching Exceptions PDF Print E-mail
Written by Ivan Fernandes   
Wednesday, 24 March 2010 09:13

Catching and handle exceptions in Objective-c/Cocoa:

 
    @try {
        if (argc > 1)  {
            @throw [NSException exceptionWithName:@"Throwing a test exception" 
                                           reason:@"Testing the @throw directive." 
                                         userInfo:nil];
        }
    } 
    @catch (id theException) {
        NSLog(@"%@", theException);
    } 
    @finally {
        NSLog(@"This always happens.");
    }
 
Last Updated on Wednesday, 24 March 2010 21:07
 
Copyright © 2017 Bright Idea Software. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.