Xcode 4.2 SIGABRT Error

走远了吗. 提交于 2019-11-26 14:29:50

问题


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]));

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?

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)


回答1:


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.

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.




回答2:


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.

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.




回答3:


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.




回答4:


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.




回答5:


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.

I suppose any infinite loops on the main thread end up being an uncaught exception.



来源:https://stackoverflow.com/questions/8748425/xcode-4-2-sigabrt-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!