[IOS笔记]

 
和c++类似,@try,@catch,@finally,@throw;
[NSException raise:@"WebService error" format:@"%@", returnJson4SOAP];  
异常类:NSException,可自定义自己的异常类,继承NSException

Cup *cup = [[Cup allocinit];

@try { [cup fill];

@catch (NSException *exception) {

NSLog(@"main: Caught %@: %@", [exception name], [exception reason]);

} @finally {

[cup release];

}

原文地址:https://www.cnblogs.com/zengyou/p/3064161.html