和c++类似,@try,@catch,@finally,@throw;
[NSException raise:@"WebService error" format:@"%@", returnJson4SOAP];
异常类:NSException,可自定义自己的异常类,继承NSException
Cup *cup = [[Cup alloc] init];
@try { [cup fill];
} @catch (NSException *exception) {
NSLog(@"main: Caught %@: %@", [exception name], [exception reason]);
} @finally {
[cup release];
}