我的应用程序在模拟器中运行良好......但在真实设备上却不行......而且我有越狱的 iPhone,所以我无法通过设备进行调试......如果我使用 try catch 这样的东西
@try
{
Statements
}
@catch (NSException *ex) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:[NSString stringWithFormat:@"%@",ex]
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
}
我的应用程序在崩溃前会在 alertview 上显示错误吗?
如果不是,我怎么能找到错误在哪里?
最佳答案
捕获异常意味着你正在做一些事情来响应这个即将发生的“错误”并且它不会使应用程序崩溃,这就是捕获异常的要点 - 告诉如何处理出现错误的情况,这样你的应用程序就不会崩溃,所以是的,警报 View 将显示...
关于objective-c - 在 xcode 中使用 try catch block 在真实设备上显示错误吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1312400/