(Null) Libc++Abi.Dylib: Terminate Called Throwing an Exception

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

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.

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

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

libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

CMYR - "his could also happen if you've wired up a button to an IBAction that doesn't exist anymore (or has been renamed)"

If you're running into this problem make sure that you go to Main.storyboard, RIGHT click on the yellow box icon (view controller) at the top of the phone outline and DELETE the outlet(s) with yellow flags.

What happens in instances like this is you probably named an action, then renamed it. You need to delete the old name and if that was the only issue will start right up in sim!

Sample Image

index 0 beyond bounds for empty array' libc++abi.dylib: terminate called throwing an exception

OK an array can be empty, in which case the following statement will cause an exception:

NSDictionary *dictionary = [[placemarks objectAtIndex:0] addressDictionary];
// ^

So guard against it, with something like:

if ([placemarks count] > 0) {
NSDictionary *dictionary = [[placemarks objectAtIndex:0] addressDictionary];
....
}

I haven't read the API docs for that completion handler, but you can probably test if error is non-nil and act accordingly (i.e. if error != nil respond to error, else process the placemarks array).

libc++abi.dylib: terminate called throwing an exception Abort trap: 6

In the line:

if (Number.at(i) != Number.at(M-i+1))

when i = 1 you try to access Number.at(M) which is out of the bounds of string M while M is the length of the string. Rather, it should be:

if (Number.at(i) != Number.at(M-i))

Core data crashe with libc++abi.dylib: terminating with uncaught exception of type NSException

It's impossible to be certain but your stack traces strongly suggest that the problem is related to updating your table view from NSFetchedResultsControllerDelegate callbacks. From one of your comments, the likeliest cause is that you're not calling beginUpdates() on the table view anywhere.

There are two basic approaches to updating a table view from NSFetchedResultsControllerDelegate. First, simple but not optimal: Don't implement controllerWillChangeContent(_:) or controller(_:didChange:at:for:newIndexPath:). Do implement controllerDidChangeContent(_:), but use that method to reloadData() on your table view. Don't bother with begin/end updates or inserting/deleting/etc rows.

The second, better but slightly more complex, is to do all of these:

  1. Implement controllerWillChangeContent(_:) and use it to call beginUpdates().
  2. Implement controller(_:didChange:at:for:newIndexPath:) to insert/update/etc rows in the table.
  3. Implement controllerDidChangeContent(_:) and use it to call endUpdates().

The "begin" and "end" calls are both crucial. I can't be 100% sure that this is what's causing your specific crash, but I'd expect leaving out beginUpdates() to cause some kind of crash.

Objective-C stack trace

A couple of useful things:

  1. If you're running your app out of Xcode, add an exception breakpoint. In the breakpoint navigator (command-6) hit the '+' at the very bottom left to add. This will pause execution on the line that throws the exception and allow you to inspect the current scope, stack, etc.

  2. If you're using gdb, use bt to print the backtrace

  3. If you're using lldb, use thread backtrace instead



Related Topics



Leave a reply



Submit