iphone object_c 也支持异常捕获,用过没有呀。 在处理UITableView, MKMapView等,你可以加一些异常捕获,因为显示数据常常出错。

下面是示例代码

@try  
{  
Statements  
}  
@catch (NSException *ex) {  
        UIAlertView *alert = [[UIAlertView alloc]  
                                     initWithTitle:[ex name]  
                                     message:[ex reason]  
                                     delegate:self  
                                     cancelButtonTitle:@"OK"  
                                     otherButtonTitles: nil];  
                                     [alert show];  
} 

相关文章:

  • 2021-07-29
  • 2021-10-08
  • 2021-08-06
  • 2021-10-22
  • 2021-05-02
  • 2022-02-14
  • 2021-12-06
猜你喜欢
  • 2021-04-22
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
相关资源
相似解决方案