Question

Im trying to make an iOS App with Xcode, until now everything worked well. I have an Navigation Controller on MainWindow.xib, first it loaded RootViewController NIB, but now I changed it to main because I want a launching screen before. But now the app crashes on startup with error "SIGABRT". Thread 1 0 abort:

0x99771bdd  <+0167>  jmp    0x99771c0c <abort+214>

in 11 UIApplicationMain it is:

0x0036da9b  <+1175>  xor    %eax,%eax

and in main.m:

  int retVal = UIApplicationMain(argc, argv, nil, nil);

where it stopped.

The new files: StartScreen.h:

#import <UIKit/UIKit.h>
#import "RootViewController.h"

@interface StartScreen : UIViewController {
    RootViewController *rootViewController;

    IBOutlet UIButton *showList;
}

@property(nonatomic, retain) RootViewController *rootViewController;

@end

StartScreen.m:

#import "StartScreen.h"

@implementation StartScreen
@synthesize rootViewController;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    [showList addTarget:self action:@selector(showListButtonClicked) forControlEvents:UIControlEventTouchUpInside];
    return self;
}

-(void)showListButtonClicked {
    if(self.rootViewController == nil) {
        RootViewController *view2 = [[RootViewController alloc] initWithNibName:@"rootviewcontroller" bundle:nil];
        self.rootViewController = view2;
        [view2 release];
    }
    rootViewController.title = @"Test";
    [self.navigationController pushViewController:self.rootViewController animated:YES];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end

The app directly shuts down after 1 second when the startup image appears....

(Another problem is, that before this error came the error "SIGKILL" appeared after closing and restarting the app in simulator)

Please help :)

Was it helpful?

Solution

Check your connections in .XIB file. It looks like the StartScreen is using a file, where "File Owner" is set to RootViewController.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top