在IOS编程中,需要常用到tableview来显示从数据库查询的信息,同时也需要对与抛出的异常进行处理。
下面将在项目中遇到的异常信息处理进行解析:
具体代码如下:
@try {
records=[XTget getResource:strURL];
}
@catch (XXTException *exception) {
if (exception.exceptionType != -100 && exception.exceptionType !=-300) {
UIAlertView *alertview=[[UIAlertView alloc] initWithTitle:@"提示" message:@"抱歉,没有查询到您需要的信息"
delegate:nil cancelButtonTitle:@"确定" otherButtonTitles: nil];
[alertview show];
records = nil;
}
return;//此处的return如果缺失,则会造成异常闪退,编程之中应该注意。
}
@finally {
}