问题描述
https://github.com/chuzhaozhi/CrashCatched 我在 git 中将这个项目加入到我的项目中,但是崩溃后 UIAlertView 在崩溃后没有响应。 正常显示UI,但是点击按钮没有动画和响应。
- (void)handleException:(NSException *)exception {
UIAlertView *alert =
[[UIAlertView alloc]
initWithTitle:@"exception"
message:[Nsstring stringWithFormat:@"message\n"]
delegate:self
cancelButtonTitle:@"quit"
otherButtonTitles:@"continue",nil];
[alert show];
CFRunLoopRef runLoop = CFRunLoopGetCurrent();
CFArrayRef allModes = CFRunLoopcopyAllModes(runLoop);
while (!self.dismissed) {
for (Nsstring *mode in (__bridge NSArray *)allModes) {
CFRunLoopRunInMode((CFStringRef)mode,0.001,false); //////////-------------------- this work normal and return 3
}
}
//点击退出
CFRelease(allModes);
NSSetUncaughtExceptionHandler(NULL);
signal(SIGABRT,SIG_DFL);
signal(SIGILL,SIG_DFL);
signal(SIGSEGV,SIG_DFL);
signal(SIGFPE,SIG_DFL);
signal(SIGBUS,SIG_DFL);
signal(SIGPIPE,SIG_DFL);
if ([[exception name] isEqual:UncaughtExceptionHandlerSignalExceptionName]) {
kill(getpid(),[[[exception userInfo] objectForKey:UncaughtExceptionHandlerSignalKey] intValue]);
} else {
[exception raise];
}
}
测试崩溃代码:
-(void)exceptionHandlerTest1{
//1、ios崩溃【数组越界】
NSArray *array= @[@"tom",@"xxx",@"ooo"];
[array objectAtIndex:5];
}
英语是游泳池,非常感谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)