ios Xcode 4.2 SIGABRT 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8748425/
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
Xcode 4.2 SIGABRT Error
提问by Henry F
Everytime I run my app on the iPad simulator, it works flawlessly. But, when I run it on the iPhone simulator, when I click the home button, I get an error in Xcode in my main.m file, saying "Thread 1: Program received signal: SIGABRT". It is highlighting this line in my main.m's code: return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
每次我在 iPad 模拟器上运行我的应用程序时,它都能完美运行。但是,当我在 iPhone 模拟器上运行它时,当我单击主页按钮时,我的 main.m 文件中的 Xcode 出现错误,说“线程 1:程序收到信号:SIGABRT”。它在我的 main.m 代码中突出显示了这一行:return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
This issue doesn't occur when I press the home button on the iPad simulator at all though. I've done a lot of research on here about this error, but nothing useful seemed to turn up. Does anyone know how to go about fixing this?
但是,当我按下 iPad 模拟器上的主页按钮时,根本不会发生此问题。我在这里做了很多关于这个错误的研究,但似乎没有任何有用的东西出现。有谁知道如何解决这个问题?
Edit: here is some more info from the debugger console
编辑:这是来自调试器控制台的更多信息
"Couldn't register None.TestApplication with the bootstrap server. Error: unknown error code. This generally means that another instance of this process was already running or is hung in the debugger.sharedlibrary apply-load-rules all Current language: auto; currently objective-c (gdb)
“无法向引导服务器注册 None.TestApplication。错误:未知错误代码。这通常意味着此进程的另一个实例已经在运行或挂在调试器中。sharedlibrary apply-load-rules all 当前语言:auto;当前目标-c (gdb)
回答by dgund
The line UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
just means that an exception was thrown during the running of your program. This could range from a memory problem, to a simple runtime error. Look in the target debugger console; it will tell you where the error occurred.
该行UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
仅表示在程序运行期间引发了异常。这可能是内存问题,也可能是简单的运行时错误。查看目标调试器控制台;它会告诉您错误发生的位置。
Edited due to edited question:I have solved this question before by restoring the iOS simulator to factory defaults (Open "iOS Simulator" Menu in the upper left -> Reset Content and Settings). Then quit the iOS simulator and Xcode, and then restart your computer. This will get rid of the other instance of the process.
由于编辑问题而编辑:我之前通过将 iOS 模拟器恢复为出厂默认设置解决了这个问题(打开左上角的“iOS 模拟器”菜单 -> 重置内容和设置)。然后退出iOS模拟器和Xcode,然后重启电脑。这将摆脱进程的另一个实例。
回答by Joe Strout
I just ran into the same issue (wasted about 2 hours on it, in fact!). There was no exception thrown. Ultimately I stumbled across an answer like this one. Resetting and restarting the simulator and XCode didn't clear it up for me, but a reboot did.
我刚刚遇到了同样的问题(实际上浪费了大约 2 个小时!)。没有抛出异常。最终,我偶然发现了这样的答案。重置并重新启动模拟器和 XCode 并没有为我清除它,但重新启动。
So, if you see this, and there is NOT something about exceptions in the backtrace, then I think a restart of your machine is likely to fix it.
因此,如果您看到这一点,并且回溯中没有关于异常的信息,那么我认为您的机器重新启动可能会修复它。
回答by Jonathan
I did all above, including restarting my computer, resetting the simulator but nothing worked so I ended up having to copy all files into a separate folder, create a new project and rebuild my nib file and then copy and paste from the files in my separate folder into my new project. Really quite nasty. If nothing works for you guys and you app isn't too complex, this may be an alternative. Maybe not the best but a water proof working one.
我做了以上所有工作,包括重新启动计算机,重置模拟器,但没有任何效果,所以我最终不得不将所有文件复制到一个单独的文件夹中,创建一个新项目并重建我的 nib 文件,然后从我单独的文件中复制和粘贴文件夹到我的新项目中。真的很恶心。如果没有什么对你们有用并且您的应用程序不太复杂,这可能是另一种选择。也许不是最好的,但防水工作。
回答by AW101
I've had very similar problems and found that if I switch from the LLDB debugger to GDB (from the Product / Scheme / Edit Scheme menu) the problem goes away. Worth a try.
我遇到了非常相似的问题,发现如果我从 LLDB 调试器切换到 GDB(从产品/方案/编辑方案菜单),问题就会消失。值得一试。
回答by Yaroslav
In my case I had some code in viewDidLayoutSubviews
, that updated layout and caused viewDidLayoutSubviews
to be called again going into an infinite loop. Moving this code solved this error.
在我的情况下,我有一些代码viewDidLayoutSubviews
,更新的布局并导致viewDidLayoutSubviews
再次调用进入无限循环。移动此代码解决了此错误。
I suppose any infinite loops on the main thread end up being an uncaught exception.
我想主线程上的任何无限循环最终都会成为未捕获的异常。