libc++abi.dylib: terminate_handler unexpectedly threw an exception - 0 stack trace iOS7 / iOS 8

廉价感情. 提交于 2019-11-30 06:32:33

问题


Randomly (that's why I ask the question), my application crashes when want to display data into textView.
The only error message I've got in my debug console is :

libc++abi.dylib: terminate_handler unexpectedly threw an exception

I Googled but can't get a clue to find how correct this and how this happens.


回答1:


Clean the project. Check each constraints and remove the corrupted one. Clean project again, it should works.




回答2:


I got the same error and a "clean" didn't resolve it.

It was caused by my internet testing flow, I check to see if WiFi is connected but not if that WiFi has an active internet connection that can resolve a supplied URL. It performs a dataWithContentsOfURL: that will ultimately fail. A similar thread made this suggestion to this question here by user Keith that helped me identify the problem -- which was to add breakpoints to C++ exceptions.

To enable -- click your breakpoints view and the very bottom click the '+' to add a breakpoint. Set it up as follows and the stack trance will be more meaningful.




回答3:


This can be caused by an outlet that is no longer existing (might have been renamed or removed).

Here is a tip on how to check outlets: Select the container view of the suspected outlet, pay attention to "!" marks in the connections inspector.




回答4:


I got this question ,because I set [self addObserver:self forKeyPath:@"_defaultAgType" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil];, but I did not remove it in dealloc. I solved this by [self removeObserver:self forKeyPath:@"_defaultAgType"]; in dealloc function.




回答5:


Another reason why it could happen is when you have a UI element declared but never added to the screen but still you try to do changes on them.

In my case I had a UIBarButtonItem declared in the code but I never added it to View. When I try to remove it without adding it, I had this issue.




回答6:


If you renamed/moved your view controller class, make sure you've checked Inherit Module From Target on Identity inspector for your scene on the storyboard



来源:https://stackoverflow.com/questions/25932033/libcabi-dylib-terminate-handler-unexpectedly-threw-an-exception-0-stack-tra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!