问题
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