I have an error in main.m "Thread 1: signal SIGABRT" How can I fix this?
Asked Answered
E

3

5

My code in the main.m file is as follows. I haven't changed it at all from when I started programming this app.

#import <UIKit/UIKit.h>

#import "rickAppDelegate.h"

int main(int argc, char *argv[])
{
    @autoreleasepool {
    return UIApplicationMain(argc, argv, nil, NSStringFromClass([rickAppDelegate class]));
    }

}

I am getting the SIGABRT error on the 'return UIApplicationMain' line. My program is an app which displays a red button and when you press it, it plays a video. This error appeared after I implemented iAds using this tutorial: http://www.ioslearner.com/implement-iads-tutorial-iphone-ipad-sdk/

It worked at first, but then I started receiving the SIGABRT error. I have done a lot of searches and cannot figure out how to fix this, In all the websites, someone asks this and then figures it out themselves or through a very vague answer which I am not able to understand. Please Help! If you answer, could you please be specific as to what I have to do. If required I can post my entire code. Thanks in advance!

Exploit answered 20/3, 2012 at 7:8 Comment(4)
run in debug mode in device and check for any exceptionsBobbe
Upload the screenshot where it's firing the exception in the code, that will be helpful to the people to understand where its being crashing and why!Smuts
Does that tutorial code work unchanged, or does it give SIGABRT too? If I recall correctly iAd had a low fillrate (sometimes gave no ads), so AdWhirl was the ticket. Whatever you choose, you can check the code to show ads against the most current implementation docs from Apple/Google. Things change and the tutorial may have old code.Trivia
After POD update getting the error Thread 1: signal SIGABRT,build is successfull but while loading dependency in xcode debugger is at main.m enter image description hereExcrescency
F
17

When you get SIGABRT on that line of main, it means that your program has raised an exception. The stack trace shows where the exception is being caught, not where it's being raised. Usually this is not helpful.

To debug the problem, you can do two things:

  1. Click the “Continue Program Execution” button in the debugger control bar, or choose Program > Debug > Continue from the menu bar. This will let the program continue the exception-raising process. It will print a message to the debugger console that will help you understand what's wrong. (You may have to continue execution a couple of times before it actually prints messages.) Read the messages carefully! They usually contain helpful information.

  2. Set an exception breakpoint. This will make Xcode stop your program at the point where the exception is being raised, so you can see the code and the stack trace that is causing the problem.

Figurate answered 20/3, 2012 at 7:23 Comment(1)
Thanks for 1. there. Now I gotta make my app crash hard so I can try it out. Suggestions? :)Trivia
G
4

SIGABRT (Signal abort) indicates that the app crash due to failure to access something which is nil or doesn't exist, usually in my experience it's broken Outlets.

  1. In the storyboard, check all your Outlets in each view controller.

enter image description here

  1. Make sure you remove the connections with yellow warnings. These are invalid outlets.

enter image description here

  1. Check your storyboard ID in the Identity Inspector if the names are correct.

  2. Check for any breakpoint in the left side of the code. enter image description here

Hope this helps someone!

Glioma answered 13/4, 2018 at 21:53 Comment(0)
K
0

You should debug your application in a file of the UIVIewController (that screen or view where application falls down). Usually this error appears when:

1)your xib is not appropriate for your outlets. For example usual UIView and UITableView control instead of UITableViewController.

2)in your program you want to use a nonexistent object. For example: if the count of array elements 3, but you want to get the 4th element.

Kelton answered 20/3, 2012 at 7:28 Comment(3)
When you try to use an object which doesn't exist you get EXC_BAD_ACCESS, not SIGABRT. Right?Trivia
I have corrected my answer. I hope it will be clear for you nowKelton
I had an issue where I was going with xibs but the project was configured to use a (nonexistant) storyboard, deleting the storyboard from the Info.plist solved it for meImpede

© 2022 - 2024 — McMap. All rights reserved.