Thread 1:Program received signal: "SIGABRT"

Discussion in 'iOS Programming' started by bezzawezza, Nov 29, 2011.

  1. bezzawezza, Nov 29, 2011
    Last edited by a moderator: Nov 29, 2011

    bezzawezza macrumors newbie

    Joined:
    Nov 29, 2011
    Location:
    Wales
    #1
    I have recently started using Xcode 4 since the iOS5 upgrade and since then I appear to be unable to run anything in the simulator.
    Tonight I have created a simple app with 3 text fields and two buttons and corresponding IBOutlets for the text fields and IBActions for the buttons and linked them all together. That is ALL I have done.
    When I run the App in the simulator it builds fine but never loads as it pauses in the debugger thingy before it gets chance to load and I get the error saying "Thread 1: Program received signal:"SIGABRT" " on the following code

    Code:
    int main(int argc, char *argv[])
    {
        @autoreleasepool {
            return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));  <-----error here
        }
    }
    What can I possibly have done to have caused this and how could I rectify it? What confuses is me is that I have other Apps which run fine in Xcode 3 but when I run in Xcode 4 the simulator gives this same error. I am very confused.
     
  2. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #2
    SIAGBORT generally means you did something wrong in the sence of, calling a Enumerate function on an image, i'm just giving examples. So you need to step through your code, of where it exactly goes wrong..
    Thing that could also happen is that you have set some old outlets, and the XIB still has these, means he won't respond to it, and will give a SIGAbort, so please double check everything.
     
  3. KnightWRX macrumors Pentium

    KnightWRX

    Joined:
    Jan 28, 2009
    Location:
    Quebec, Canada
    #3
    Run a backtrace after the SIGABRT was received to see exactly where in the code it was triggered. If it's in your methods/classes, step through them using breakpoints and the debugger to see what line causes it and what is the content of your variables at that time.

    If it's in Apple's code, this may still be because of something you're doing (passing nil arguments, over-releasing objects, releasing objects that aren't yours...). The backtrace should give you clues already, and then using Profiler should help you trace it back to the faulty code.
     
  4. RonC macrumors regular

    Joined:
    Oct 18, 2007
    Location:
    Chicago-area
    #4
    I've had this happen to me as well, on the very first app I tried to create using Xcode 4.2, and I was able to successfully recreate it just now.

    1. Create a new project, let's call it Crash-o-matic. It's a Single View Application.
    2. Do not check any of the boxes (Use storyboard, Use Automatic Reference Counting, Include Unit Tests all unchecked), set prefix to CM.
    3. Add a label to the view in the CMViewController.xib - I added a label that said "Hello, World!"
    4. On Project Summary tab, set Main Interface to CMViewController.

    Watch program crash - here's the stack backtrace:
    Code:
    (gdb) where
    #0  0x91a0ec5a in __kill ()
    #1  0x91a0ec4c in kill$UNIX2003 ()
    #2  0x91aa15a5 in raise ()
    #3  0x91ab76e4 in abort ()
    #4  0x91a33b1b in _Unwind_Resume ()
    #5  0x012efe39 in CFRunLoopRunSpecific ()
    #6  0x012efccb in CFRunLoopRunInMode ()
    #7  0x0000f2a7 in -[UIApplication _run] ()
    #8  0x00010a9b in UIApplicationMain ()
    #9  0x00001d12 in main (argc=1, argv=0xbfffed10) at /Users/qa1007/Documents/Personal/Xcode/Crash-o-matic/Crash-o-matic/main.m:16
    #10 0x00001c85 in start ()
    
    Now go change the Main Interface to nothing and rebuild. Works fine.

    When I look at the code in CMAppDelegate.m, I see the following:
    Code:
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
        // Override point for customization after application launch.
        self.viewController = [[[CMViewController alloc] initWithNibName:@"CMViewController" bundle:nil] autorelease];
        self.window.rootViewController = self.viewController;
        [self.window makeKeyAndVisible];
        return YES;
    }
    
    
    What I think is happening is when the interface is set, the UIApplication tries to load the main interface that doesn't have a UIWindow object and it gets very confused and causes this problem. When no interface is set, it doesn't try to load anything and just calls the delegate application:didFinishLaunchingWithOptions: method that then creates a window object and loads the view controller into it and runs normally from there.

    I suspect you did the same thing I did the first time I tried Xcode 4.2 and set the Main Interface because I didn't like it being blank.

    To make it work, I just selected the text for the Main Interface setting and deleted it (so the field was empty), rebuilt and reran.
     
  5. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #5
    I create a XIB to go with my UIApplication. This will create the window, so you need to hook that up via the old school AppDelegate ways, then add the controller you need. I don't use any of the new techniques, since the old ones worked fine for me.. And If I just go to old way there, adding a View Controller, or a navigation controller, and then do it the oldie way :) that should do fine.
     
  6. Daadian macrumors newbie

    Joined:
    Jan 22, 2012
    #6
    Thank you !!!

    I don't know if you are still following this page but you just helped me a ton so I registered for the site just to say thanks for posting.

    This was my exact problem, the exact thing I had done and the exact fix that fixed it LOL. That stupid blank entry was just begging to be filled in !
     
  7. dbendixen macrumors member

    Joined:
    Oct 22, 2010
    #7
  8. ARD31215, Apr 19, 2012
    Last edited by a moderator: Apr 20, 2012

    ARD31215 macrumors newbie

    Joined:
    Apr 19, 2012
    #8
    Need help asap

    Hey , I'm making a ping pong game and I keep getting a SIGABRT error in my main.m file only when I have the audio line of code in my .m file


    Code:
        NSString *clapPath = [[NSBundle mainBundle] pathForResource:@"Clapping Crowd Studio 01" ofType:@"caf"];
    	CFURLRef clapURL = (CFURLRef ) [NSURL fileURLWithPath:clapPath];
    	AudioServicesCreateSystemSoundID (clapURL, &clappingFileID);
        
    	NSString *volleyPath = [[NSBundle mainBundle] pathForResource:@"Tennis Volley 01" ofType:@"caf"];
    	CFURLRef volleyURL = (CFURLRef ) [NSURL fileURLWithPath:volleyPath];
    	AudioServicesCreateSystemSoundID (volleyURL, &volleyFileID);
    


    when i remove it the program runs fun but without sound . Any idea how I can fix this


    my main.m file is
    Code:
    #import <UIKit/UIKit.h>
    
    #import "iTennisAppDelegate.h"
    
    int main(int argc, char *argv[])
    {
        @autoreleasepool {
            return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
        }
    }
    
    
    please help me
     
  9. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #9
    In the debugger console there is a message printed when you get a SIGABRT. It starts with "Terminating app..." Post the contents of that message here.
     
  10. solutionsagent macrumors newbie

    Joined:
    Jul 24, 2011
    Location:
    Manila
    #10
    Dude, thanks!

    Hey I know this is REALLY old, but thank you! You solved my problem! I wasn't getting any errors and it was running with a black screen...

    The problem was that I had an old outlet I had to delete because I renamed it later. Thanks a lot! :)
     
  11. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #11
    Hey, great to hear :) Good luck wiht further development!
     
  12. carah90 macrumors newbie

    Joined:
    Feb 18, 2013
    #12
    Help

    Hi I keep getting the same error: terminating app due to uncaught exception 'nsunknownkeyexception'

    Here is my file: https://www.dropbox.com/sh/raeiqb4fr2fnj3b/mjQowMlCvl

    I would be really grateful if someone could fix it for me or tell me what the problem is. I have been looking in Forums all day and haven't managed to find the problem.

    Thank you!
     
  13. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #13
    You're probably better off providing a code snippet in a post of the offending method from your code, as well as highlighting the line causing the exception.
     
  14. carah90, Feb 18, 2013
    Last edited by a moderator: Feb 18, 2013

    carah90 macrumors newbie

    Joined:
    Feb 18, 2013
    #14
    Help

    Ok so...
    Basically it says that my error is in this code:
    Code:
    [B].h[/B]
    
    #import <UIKit/UIKit.h>
    #import "Kontakt.h"
    
    @interface KontaktDetailViewController : UIViewController
    
    @property (weak, nonatomic) IBOutlet UITextView *addressTextView;
    @property (weak, nonatomic) IBOutlet UITextView *details1TextView;
    @property (weak, nonatomic) IBOutlet UITextView *details2TextView;
    @property (weak, nonatomic) IBOutlet UITextView *details3TextView;
    @property (weak, nonatomic) IBOutlet UITextView *details4TextView;
    @property (weak, nonatomic) IBOutlet UITextView *details5TextView;
    @property (weak, nonatomic) IBOutlet UITextView *details6TextView;
    @property (weak, nonatomic) IBOutlet UITextView *details7TextView;
    
    @property (nonatomic, strong) Kontakt *kontakt;
    
    @end
    
    
    
    
    [B].m[/B]
    
    
    #import "KontaktDetailViewController.h"
    #import "Kontakt.h"
    
    @interface KontaktDetailViewController ()
    
    @end
    
    @implementation KontaktDetailViewController
    @synthesize kontakt;
    
    
    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    {
        self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
        if (self) {
            // Custom initialization
        }
        return self;
    }
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        
        self.title = kontakt.name;
        
        NSMutableString *addressText = [NSMutableString string];
        for (NSString* address in kontakt.address) {
            [addressText appendFormat:@"%@\n", kontakt];
        }
        self.addressTextView.text = addressText;
        
        NSMutableString *details1Text = [NSMutableString string];
        for (NSString* details1 in kontakt.details1) {
            [details1Text appendFormat:@"%@\n", kontakt];
        }
        self.details1TextView.text = details1Text;
        
        NSMutableString *details2Text = [NSMutableString string];
        for (NSString* details2 in kontakt.details2) {
            [details2Text appendFormat:@"%@\n", kontakt];
        }
        self.details2TextView.text = details2Text;
        
        NSMutableString *details3Text = [NSMutableString string];
        for (NSString* details3 in kontakt.details3) {
            [details3Text appendFormat:@"%@\n", kontakt];
        }
        self.details3TextView.text = details3Text;
        
        NSMutableString *details4Text = [NSMutableString string];
        for (NSString* details4 in kontakt.details4) {
            [details4Text appendFormat:@"%@\n", kontakt];
        }
        self.details4TextView.text = details4Text;
        
        NSMutableString *details5Text = [NSMutableString string];
        for (NSString* details5 in kontakt.details5) {
            [details5Text appendFormat:@"%@\n", kontakt];
        }
        self.details5TextView.text = details5Text;
        
        NSMutableString *details6Text = [NSMutableString string];
        for (NSString* details6 in kontakt.details6) {
            [details6Text appendFormat:@"%@\n", kontakt];
        }
        self.details6TextView.text = details6Text;
        
        NSMutableString *details7Text = [NSMutableString string];
        for (NSString* details7 in kontakt.details7) {
            [details7Text appendFormat:@"%@\n", kontakt];
        }
        self.details7TextView.text = details7Text;
    }
    
    - (void)didReceiveMemoryWarning
    {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    }
    
    
    @end
     
  15. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #15
    Also, "fix it for me" is the wrong attitude. We're happy to help you free of charge, but most of us charge if we're going to be doing it all for someone else.
     
  16. carah90 macrumors newbie

    Joined:
    Feb 18, 2013
    #16
    I don't want anyone to do all of it. I want to know what is wrong so I can keep getting on with it. I'm stuck, that is all. And considering I have wasted a lot of time trying to figure it out, it would be nice if someone with more experience, who actually knows what is wrong, could be so kind and help me out.
     
  17. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #17
    Which line?
     
  18. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #18
    The red-hilited kontakt makes no sense to me, in the loop context.

    Since you've copy-pasted the same thing a total of 8 times, you have 8 fixes to make (if this is a bug). If you'd made a function or method, you'd have one place to fix, as well as one place to put a breakpoint, so you could see what happens using the debugger. Or are you not using the debugger?
     
  19. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
  20. carah90 macrumors newbie

    Joined:
    Feb 18, 2013
    #20
    2013-02-22 09:53:48.683 KSA[566:c07] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<KontaktDetailViewController 0x8a77980> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Text1.'
    *** First throw call stack:
    (0x1ca3012 0x10e0e7e 0x1d2bfb1 0xb8ce41 0xb0e5f8 0xb0e0e7 0xb38b58 0x242019 0x10f4663 0x1c9e45a 0x240b1c 0x1057e7 0x105dc8 0x105ff8 0x106232 0x1064da 0x11d8e5 0x11d9cb 0x11dc76 0x11dd71 0x11e89b 0x11ee93 0x11ea88 0x47ae63 0x46cb99 0x46cc14 0xd4249 0xd44ed 0xade5b3 0x1c62376 0x1c61e06 0x1c49a82 0x1c48f44 0x1c48e1b 0x1bfd7e3 0x1bfd668 0x24ffc 0x828d 0x1dc5)
    libc++abi.dylib: terminate called throwing an exception
    (lldb)
     
  21. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #21
    SIGABRT is a runtime exception that happens when there is some error that can only be detected at runtime.

    Yours is happening when the KontaktDetailViewController.xib file is being loaded. During that load an attempt is being made to connect an IBOutlet named Text1, but there is no IBOutlet with that name.

    Presumably you had such an IBOutlet at one time but removed it.

    To fix this: open the nib in IB and remove the connection to that IBOutlet. It will probably show up in yellow in the HUD window for File's Owner.
     
  22. carah90 macrumors newbie

    Joined:
    Feb 18, 2013
    #22
    that worked. Thank you!
     

Share This Page