线程1:信号SIGABRT错误

时间:2012-11-03 09:29:57

标签: iphone objective-c xcode

我有一个问题..我在我的xcode项目中得到了这个:

#import

int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);  -> Thread 1: Signal SIGABRT
[pool release];
return retVal;

}

而且我真的不知道如何解决这个问题。请帮助我P !! ...

头:

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>#import "RootA.h"
#import "RootB.h"
#import "RootC.h"
#import "RootD.h"
#import "RootE.h"
#import "RootF.h"
#import "RootG.h"



@interface TabOneViewController : UIViewController {

}
- (IBAction)switchViewsToRootA:(id)sender;

- (IBAction)switchViewsToRootB:(id)sender;

- (IBAction)switchViewsToRootC:(id)sender;

- (IBAction)switchViewsToRootD:(id)sender;

- (IBAction)switchViewsToRootE:(id)sender;

- (IBAction)switchViewsToRootF:(id)sender;

- (IBAction)switchViewsToRootG:(id)sender;

@end

主:

#import "TabOneViewController.h"


@implementation TabOneViewController

- (IBAction)switchViewsToRootA:(id)sender {

 UIBarButtonItem *mainButton = [[UIBarButtonItem alloc] 
 initWithTitle:@"Back" 
 style:UIBarButtonItemStyleBordered 
 target:self
 action:@selector(mainMenu:)];
 self.navigationItem.backBarButtonItem = mainButton;
 [mainButton release];

RootA *rootA = [[RootA alloc] initWithNibName:@"RootA" bundle:nil];
[self.navigationController pushViewController:rootA animated:YES];
[rootA release];


}

- (IBAction)switchViewsToRootB:(id)sender {

UIBarButtonItem *mainButton = [[UIBarButtonItem alloc] 
                               initWithTitle:@"Back" 
                                   style:UIBarButtonItemStyleBordered 
                               target:self
                               action:@selector(mainMenu:)];
self.navigationItem.backBarButtonItem = mainButton;
[mainButton release];

RootB *rootB = [[RootB alloc] initWithNibName:@"RootB" bundle:nil];
[self.navigationController pushViewController:rootB animated:YES];
[rootB release];
}   

- (IBAction)switchViewsToRootC:(id)sender {

UIBarButtonItem *mainButton = [[UIBarButtonItem alloc] 
                               initWithTitle:@"Back" 
                               style:UIBarButtonItemStyleBordered 
                               target:self
                               action:@selector(mainMenu:)];
self.navigationItem.backBarButtonItem = mainButton;
[mainButton release];

RootC *rootC = [[RootC alloc] initWithNibName:@"RootC" bundle:nil];
[self.navigationController pushViewController:rootC animated:YES];
[rootC release];
}   

- (IBAction)switchViewsToRootD:(id)sender {

UIBarButtonItem *mainButton = [[UIBarButtonItem alloc] 
                               initWithTitle:@"Back" 
                               style:UIBarButtonItemStyleBordered 
                               target:self
                               action:@selector(mainMenu:)];
self.navigationItem.backBarButtonItem = mainButton;
[mainButton release];

RootD *rootD = [[RootD alloc] initWithNibName:@"RootD" bundle:nil];
[self.navigationController pushViewController:rootD animated:YES];
[rootD release];
}   

- (IBAction)switchViewsToRootE:(id)sender {

UIBarButtonItem *mainButton = [[UIBarButtonItem alloc] 
                               initWithTitle:@"Back" 
                               style:UIBarButtonItemStyleBordered 
                               target:self
                               action:@selector(mainMenu:)];
self.navigationItem.backBarButtonItem = mainButton;
[mainButton release];

RootE *rootE = [[RootE alloc] initWithNibName:@"RootE" bundle:nil];
[self.navigationController pushViewController:rootE animated:YES];
[rootE release];
}   

- (IBAction)switchViewsToRootF:(id)sender {

UIBarButtonItem *mainButton = [[UIBarButtonItem alloc] 
                               initWithTitle:@"Back" 
                               style:UIBarButtonItemStyleBordered 
                               target:self
                               action:@selector(mainMenu:)];
self.navigationItem.backBarButtonItem = mainButton;
[mainButton release];

RootF *rootF = [[RootF alloc] initWithNibName:@"RootF" bundle:nil];
[self.navigationController pushViewController:rootF animated:YES];
[rootF release];
}   

- (IBAction)switchViewsToRootG:(id)sender {

UIBarButtonItem *mainButton = [[UIBarButtonItem alloc] 
                               initWithTitle:@"Back" 
                               style:UIBarButtonItemStyleBordered 
                               target:self
                               action:@selector(mainMenu:)];
self.navigationItem.backBarButtonItem = mainButton;
[mainButton release];

RootG *rootG = [[RootG alloc] initWithNibName:@"RootG" bundle:nil];
[self.navigationController pushViewController:rootG animated:YES];
[rootG release];
}   


    #pragma mark -
    #pragma mark Table view data source

        - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
        // Return the number of sections.
        return 1;
    }


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    // Return the number of rows in the section.
    return 1;
}


// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    // Configure the cell...

    return cell;
}




#pragma mark -
#pragma mark Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // Navigation logic may go here. Create and push another view controller.
    /*
    <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
    // ...
    // Pass the selected object to the new view controller.
    [self.navigationController pushViewController:detailViewController animated:YES];
    [detailViewController release];
    */
}


#pragma mark -
#pragma mark Memory management

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Relinquish ownership any cached data, images, etc. that aren't in use.
}

- (void)viewDidUnload {
    // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
    // For example: self.myOutlet = nil;
}


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


@end

1 个答案:

答案 0 :(得分:1)

有时会出现此错误,因为已将IBOutlet连接到IB,然后删除了该ivar。检查所有IBOutlet是否正确连接。

然后检查您的viewcontroller的viewDidLoadviewWillAppearviewDidAppear方法中是否有任何错误代码。