赞
踩
APP的崩溃可以分为两类:信号可捕捉崩溃 和 信号不可捕捉崩溃。
./symbolicatecrash ./xxx.crash ./xxx.app.dSYM > symbol.crash
如以下 线程帧 记录了 这些信息
2
YDTCMoments
0x34648e88
0x83000 + 8740
Defined in header <signal.h>
#define SIGTERM /*implementation defined*/
#define SIGSEGV /*implementation defined*/
#define SIGINT /*implementation defined*/
#define SIGILL /*implementation defined*/
#define SIGABRT /*implementation defined*/
#define SIGFPE /*implementation defined*/
... ...
NSSetUncaughtExceptionHandler { exception in
print("exception: \(exception.callStackSymbols)")
}
OC:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSSetUncaughtExceptionHandler(&caughtExceptionHandler); /* Changes the top-level error handler. Sets the top-level error-handling function where you can perform last-minute logging before the program terminates */ return YES; } void caughtExceptionHandler(NSException *exception){ /** * 获取异常崩溃信息 */ NSArray *callStack = [exception callStackSymbols]; NSString *reason = [exception reason]; NSString *name = [exception name]; NSString *content = [NSString stringWithFormat:@"========异常错误报告========\nname:%@\nreason:\n%@\ncallStackSymbols:\n%@",name,reason,[callStack componentsJoinedByString:@"\n"]]; //把异常崩溃信息发送至开发者邮件 NSMutableString *mailUrl = [NSMutableString string]; [mailUrl appendString:@"mailto:xxx@qq.com"]; [mailUrl appendString:@"?subject=程序异常崩溃信息,请配合发送异常报告,谢谢合作!"]; [mailUrl appendFormat:@"&body=%@", content]; // 打开地址 NSString *mailPath = [mailUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:mailPath]]; }
iOS开发这么些年一直没去整理过这些东西,现在静下心来开始去整理,后续会持续更新,如果内容有用感谢点赞,如有问题欢迎评论留言
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。