(lldb) Xcode 上的运行时错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16999127/
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
(lldb) Run time Error on Xcode
提问by C.Farrugia
I have this code and it is not working for me and creating a runtime error
我有这段代码,但它对我不起作用并产生运行时错误
-(void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
//position button
myButton.frame = CGRectMake(50, 50, 50, 50);
[myButton setTitle:@"\u2606" forState:UIControlStateNormal];
// add targets and actions
[myButton addTarget:self action:@selector(myButtonClicked) forControlEvents:UIControlEventTouchUpInside];
// add to a view
[self.view addSubview:myButton];
}
-(void)myButtonClicked{
[myButton setTitle:@"\u2605" forState:UIControlStateNormal];
}
I got this from this website and cannot find a way to remove this runtime error. Thanks
我从这个网站上得到了这个,但找不到消除这个运行时错误的方法。谢谢
回答by Matthias Bauch
This is pretty much guessing, but I did experience the same problem.
这几乎是猜测,但我确实遇到了同样的问题。
It might be coincidence, but for me this problem appeared the first time after I updates OS X to 10.8.4. Since then every other Run ends in a crash.
这可能是巧合,但对我来说这个问题是在我将 OS X 更新到 10.8.4 后第一次出现的。从那以后,每一次 Run 都以崩溃告终。
The backtrace for my case looks like this:
我的案例的回溯如下所示:
(lldb) bt
* thread #1: tid = 0x1c03, 0x9573da6a libsystem_kernel.dylib`__pthread_kill + 10, stop reason = signal SIGABRT
frame #0: 0x9573da6a libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x9476ab2f libsystem_c.dylib`pthread_kill + 101
frame #2: 0x024e857b libsystem_sim_c.dylib`abort + 140
frame #3: 0x026afb4e GraphicsServices`GSRegisterPurpleNamedPort + 348
frame #4: 0x026af69f GraphicsServices`_GSEventInitialize + 123
frame #5: 0x026afc1f GraphicsServices`GSEventInitialize + 36
frame #6: 0x0076ed99 UIKit`UIApplicationMain + 600
frame #7: 0x0000225d XXX 3`main(argc=1, argv=0xbffff36c) + 141 at main.m:16
frame #8: 0x00002185 XXX 3`start + 53
Since it works perfectly fine 50% of all launches, and it worked the months before I did the update, and it works with gdb, I'm pretty sure this is a bug on Apples side.
由于它在所有发布的 50% 中都运行良好,并且在我进行更新之前的几个月内运行良好,并且可以与 gdb 配合使用,因此我很确定这是 Apple 方面的错误。
A workaround for this problem might be to switch from lldb to gdb. It worked for me.
此问题的解决方法可能是从 lldb 切换到 gdb。它对我有用。
You do this in the scheme editor (press command+ <). Change the debugger to gdb in the Run scheme.
您可以在方案编辑器中执行此操作(按command+ <)。在运行方案中将调试器更改为 gdb。
Since this is like the third question (others were closed already) or so that I saw on stackoverflow in the few days since 10.8.4 was released I'm pretty sure this behaviour is related to the update.
由于这就像第三个问题(其他人已经关闭)或者我在 10.8.4 发布后的几天内在 stackoverflow 上看到的,我很确定这种行为与更新有关。