// 提交异常Log信息
void UncaughtExceptionHandler(NSException *exception) {
// 异常Log信息
NSString *errorStr = [NSString stringWithFormat:@"错误详情:%@\n%@\n%@",
[exception name], [exception reason], [[exception callStackSymbols] componentsJoinedByString:@"\n"]];
// 提交到服务器
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:device_exception, Host]];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setRequestMethod:@"POST"];
[request setPostValue:errorStr forKey:@"exception"];
[request setPostValue:@"1" forKey:@"device"];
[request startSynchronous];
}
// AppDelegate中调用
NSSetUncaughtExceptionHandler(&UncaughtExceptionHandler); //设置异常Log信息的处理