ios (null) libc++abi.dylib: 终止调用抛出异常

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11289014/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 19:05:21  来源:igfitidea点击:

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

iosxcodeipadobjective-c-2.0

提问by Masaru Kitajima

I use Xcode 4.5PR and iOS 6beta 2.

我使用 Xcode 4.5PR 和 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?

我怎样才能找到问题?我该如何解决?

采纳答案by Old McStopher

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

如果您没有进行任何更改,这可能只是与目前的 iOS 6 测试版有关。

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 :

1) 它可能是您选择为以下对象构建相同代码的模拟器:

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.)

如果您没有更改任何源代码,请检查以确保您的方案仍然指向它上次使用的同一个模拟器。(例如,尝试呈现一个模态视图控制器 ( presentModalViewController:),但忘记有条件地使用 iPad 的弹出框,可能会导致这种情况。)

2) If the stack trace and console are unhelpful :

2) 如果堆栈跟踪和控制台没有帮助:

Sometimes, the only things in the stack are mainand 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.

有时,堆栈中唯一的东西是mainand UIApplicationMain,这使得很难追踪您自己的源代码中出了什么问题。这可能表明您正在调用或导致调用的本机框架方法出现故障。

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.

如果控制台中未列出任何方法或特定对象,并且堆栈跟踪未指向您自己的类中的任何方法,请尝试将执行范围缩小到尽可能接近引发异常的点。在黑暗中选择断点时,我倾向于使用二进制搜索方法,选择一个枢轴点并上下移动执行顺序,并根据需要选择一个新的“中途”点。

回答by Keith

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

在 C++ 异常上设置断点以查找抛出异常的位置。

enter image description here

在此处输入图片说明

回答by Develomentional

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.

确保您使用的是 xcode 的开发者预览版 (4.5) 并且没有习惯性地打开发行版 (4.3.3) 并且如果您没有更新项目设置,则肯定有 iOS 测试版匹配您无法运行将项目设置更新到 iOS 6 后,iOS 6 beta 上的应用程序将不再在 iOS 5.xx 设备上运行。

回答by BarryK88

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

当我在对象 iso 上设置限制并将其分配给超级视图时,就会发生这种情况

回答by DevonDahon

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.

在我的 .h 和 .m 文件中更改了一些 iboutlet 变量的名称后,我遇到了这个错误,但在这些变量的故事板链接中没有。重做链接后,一切又正常了。希望这可以帮助你们中的一些人。

回答by cowfaboo

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.frameworkto my project.

有时,如果您只是缺少一个库,就会发生这种情况 - 我正在使用 MKMapView 制作一个快速示例应用程序,并且在将MapKit.framework添加到我的项目之前出现了这个错误。

回答by Shiv Kumar

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.

有时当用户导入任何框架时会出现问题,因此还要将该框架导入到应用程序资源文件夹中的 .pch 文件中。希望这可以帮助你们中的一些人。

回答by funkybro

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

这发生在我身上,当我在“其他链接器标志”中设置 -ObjC 时就消失了

回答by Saurabh Hooda

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:

发生此异常的原因有多种。找到确切根本原因的最佳方法是查看console. 在那里你会找到这样的文字:

*** 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

*** 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 ipsumbefore First throw call stackwill pinpoint exact issue why exception is being thrown. Fix that problem and you are good to go.

这里的文本lorem ipsum之前First throw call stack将指出为什么抛出异常的确切问题。解决这个问题,你就可以开始了。

回答by ColossalChris

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!

当您从项目中手动删除 Storyboard 并重新调整视图控制器的用途以在没有情节提要的情况下使用时,通常会出现此错误。确保您的视图控制器已添加到 AppDelegate 窗口的根视图控制器中,并且视图控制器 init 没有笔尖名称(因为您在删除情节提要时会删除该名称) - 并且最重要的是从 pList 中删除行告诉应用程序应该存在故事板文件的文件,例如“主故事板文件基本名称(iPad)”或“主要故事板文件基本名称(iPhone)”。一旦这些都消失了,您的应用程序将停止寻找故事板,您将像金毛猎犬一样金黄!