ios - 为什么 uncaughtexceptionhandler 在发布版本中不起作用
问题描述
这是我在应用程序委托中未捕获的异常处理程序,我正在注册它。
void myHandler(NSException * exception)
{
NSError *error;
NSString *stringToWrite = [[NSString alloc]initWithFormat:@"Name:%@ Reason:%@ CallStackSymbols:%@",exception.name,exception.reason,exception.callStackSymbols];
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:@"crashlog.txt"];
[stringToWrite writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:&error];
}
- (BOOL) application : (UIApplication*) application didFinishLaunchingWithOptions : (NSDictionary*) launchOptions {
NSSetUncaughtExceptionHandler(&myHandler);
}
我已启用 iTunes 文件共享以查看崩溃日志
在发布版本崩溃之后..我无法在 iTunes 中找到该文件,而我可以在调试版本中找到它。
(我有数组索引超出范围的错误......来测试它)
有人可以解释一下发生了什么吗
解决方案
推荐阅读
- linux - 2 个 AWS EC2 实例之间的 rsync:找不到 .pem 文件
- javascript - 将外部变量传递给弹出窗口中的字段:(arcgis-js-api)
- apache-spark - 从 pyspark 读取 hbase
- java - 无法处理部件,因为没有提供多部件配置 enctype='multipart/form-data' 使用问题
- c++ - 编译在我的 Mac 上工作,但不在集群上(Linux)
- node.js - 如何将文件上传到 mongodb GridFs?
- python - Python for 循环乘法列表
- java - 在 Service 类的构造函数中使用 JPA 存储库访问
- python - Python heapq.heappop() 与 pop(0)
- javascript - TypeError 错误:无法读取未定义的属性“过滤器”