(null) libc++abi.dylib: terminate called throwing

2019-01-13 11:58发布

问题:

I use Xcode 4.5PR and iOS 6beta 2.

I didn't change any codes, my application throw an exception mentioned in the Title.

I used Debug Window which function caused this exception, but it showing

0x38dda960:  push   {r4, r5, r6, r7, lr}

How can I find a problem? How can I fix it?

回答1:

If you didn't change anything, this could just simply be related to the iOS 6 beta as it currently stands.

However, for those googling upon this error, here are some general suggestions:

1) It could be the simulator you've chosen to build the same code for :

If you haven't changed any source code, check to make sure your scheme is still pointing to the same simulator that it last worked on. (For example, trying to present a modal view controller (presentModalViewController:), but forgetting to conditionally use a popover for iPad, could cause this.)

2) If the stack trace and console are unhelpful :

Sometimes, the only things in the stack are main and UIApplicationMain, which makes it difficult to trace what went wrong in your own source. This is likely a sign that something is failing in a native framework method that you're calling or causing to be called.

If no method or specific object is listed in the console and the stack trace does not point to any methods from your own classes, try to narrow down the execution as close as you can to the point at which the exception is thrown. When picking breakpoints in the dark, I tend to use a binary search approach, picking a pivot point and moving up and down the execution order and picking a new "halfway" point as necessary.



回答2:

Set a breakpoint on C++ exceptions to find where it's being thrown.



回答3:

Make sure you are using the developer preview version (4.5) of xcode and didn't by habit open the release version (4.3.3) and definitely have the iOS beta to match if you haven't updated the project settings you cannot run the app on iOS 6 beta after you update the project settings to iOS 6 the app will no longer run on iOS 5.x.x devices anymore one on the other.



回答4:

It happens here when I set a contrain on an object i.s.o. asigning it to the superview



回答5:

A reason for this error to arise...

I had this error after changing the name of some iboutlet variables in my .h and .m files but not in the storyboard links for these variables. After redoing the links, everything worked fine again. Hope this can help some of you.



回答6:

Sometimes this can happen if you're simply missing a library - I was making a quick sample app with an MKMapView and had this error come up before I added MapKit.framework to my project.



回答7:

Some time problem occur when user import any framework so also import that framework in .pch file in resource folder of application.Hope this can help some of you.



回答8:

This was happening to me and went away when I set -ObjC in "Other Linker Flags"



回答9:

This exception can occur for variety of reasons. Best way to find the exact root cause is to look at console. There you will find text like this:

*** lorem ipsum lorem ipsum lorem ipsum
*** First throw call stack: (0x1d16012 0x16c3e7e 0xa4ef96 0x607704 0x6079a2 0x606876 0x617cb5 0x618beb 0x60a698 0x2b81df9 0x2b81ad0 0x1c8bbf5 0x1c8b962 0x1cbcbb6 0x1cbbf44 0x1cbbe1b 0x60617a 0x607ffc 0x1d1d 0x1c45) libc++abi.dylib: terminate called throwing an exception

Here text lorem ipsum before First throw call stack will pinpoint exact issue why exception is being thrown. Fix that problem and you are good to go.



回答10:

This error is commonly seen when you manually delete your Storyboard from your project and repurpose your viewcontroller to be used without a storyboard. Make sure your view controller is added to the root view controller of your window in your AppDelegate and that the view controller init's without a nib name (since you would have deleted that when removing your storyboard) - AND MOST IMPORTANTLY remove the rows from your pList file that tell the application that a storyboard file should exist such as 'Main storyboard file base name (iPad)' or 'Main storyboard file base name (iPhone)'. Once those are gone your app will stop looking for a storyboard and you'll be golden like a golden retriever!



回答11:

I got this stuck for quite a while, and then I found that I could get the EXACT trace stack of the exception by setting a breakpoint for all exceptions.