http://blog.csdn.net/daiyelang/article/details/17020211
基础代码
在系统启动时调用
NSSetUncaughtExceptionHandler (&UncaughtExceptionHandler);
//[StoreageMessage getErrorMessage:crashLogInfo fromUrl:@"zhuyebengkuichuxianwenti"];
将错误发送给服务器指定url 也可以发送至邮箱
void UncaughtExceptionHandler(NSException *exception) {
NSArray *arr = [exception callStackSymbols];//得到当前调用栈信息
NSString *reason = [exception reason];//非常重要,就是崩溃的原因
NSString *name = [exception name];//异常类型
NSLog(@"exception type : %@ \n crash reason : %@ \n call stack info : %@", name, reason, arr);
NSString *crashLogInfo = [NSString stringWithFormat:@"exception type : %@ \n crash reason : %@ \n call stack info : %@", name, reason, arr];
[StoreageMessage getErrorMessage:crashLogInfo fromUrl:@"zhuyebengkuichuxianwenti"];
}