开发者

sigabrt with no error message

开发者 https://www.devze.com 2023-04-13 06:20 出处:网络
I开发者_JAVA百科 have a strange problem, i am getting a Sigabrt in main loop, but no error message is displayed, i\'ve looked quite a lot on this in the internet but didn\'t manage to find anything us

I开发者_JAVA百科 have a strange problem, i am getting a Sigabrt in main loop, but no error message is displayed, i've looked quite a lot on this in the internet but didn't manage to find anything useful. So my question would be, how to track what is causing sigabrt with no error message?

Thanks in advance.


When your program crashes, you can go to the debugger console and type bt (backtrace) which will give you an idea of what code was being executed at the time of the crash. The top level items may not be your code, but if you keep moving down you should see something of yours in there eventually.

If there aren't any calls from your code then these SIGABRT errors are often related to your xib files, there will be something missing or renamed or otherwise changed in a xib file that hasn't been reflected in your code.


For way too long, I thought the console was giving me no information with XCode 8 but then I realized I just had hidden the console and needed to show it again.

sigabrt with no error message

For anyone else stuck in a weird brain warp like I was:

  1. Press that button and see what XCode is telling you is broken, fix it

  2. Enjoy life again!


Have you looked in the logs?

Have you tried running in the debugger? It should stop and give you a stack trace when it. Also try setting a break point on all exceptions.


For SIGABRT errors, run in debug until the program crashes. Then, there should be a little black button with the text "GDB" in yellow over it above your code editor in your mini-debugging bar. Click it, and it will bring up your debugger console. This should show the sig-abort report, possibly an alert stating that it was caused by an unhandled thrown exception, the stack trace of all nested function calls, and above that, one or more messages dealing with what specifically went wrong.

I don't know what is wrong with the actual startup error, but it could be very likely you changed the name of some class in your code that was referenced by your xib files, and didn't change the references in Interface Builder.

only ever get this error when the app is calling on something that is missing from resources.

e.g I have an (IBAction) which plays a sound but the sound is no longer part of the app.

Check all of your called resources in your code and make sure they're still in your xcode project. Even images used in Interface builder can produce a SIGARBT.

It's an annoying error because 9/10 times the debugger doesn't tell you what's wrong.


In my case, I didn't handle asynchronous calls and multi-threading properly, and I got a SIGABRT crash without any messages.

It's really hard to debug in this situation, but a general hint is using callbacks to handle your series of actions. Don't run too many actions at the same time even they are irrelevant to each other.


In my case, the problem was an observer that wasn't being removed after a view got dismissed. Specifically an observer on the @"myLocation" in Google Maps.

So I have this on viewDidLoad:

[self.mapView addObserver:self
               forKeyPath:@"myLocation"
                  options:NSKeyValueObservingOptionNew
                  context:NULL];

But I never removed that and I would constantly crash my app when dismissing the map view.

I added this:

-(void)dealloc{
    [self.mapView removeObserver:self forKeyPath:@"myLocation"];
}

And problem solved.

0

精彩评论

暂无评论...
验证码 换一张
取 消