2012-11-03 128 views
0

我有一個問題..我在Xcode項目得到這個:線程1:信號SIGABRT錯誤

#進口

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; 

}

,我真的不知道該怎麼解決這個問題..幫助我的快樂!

頭:

#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 
+0

使用IBOutlate檢查按鈕和首次使用文件所有者連接的UIView是否連接? –

+0

使用斷點導航器設置Objective-C異常的斷點。它可能會給你一個更有用的錯誤信息。 –

+0

你能告訴我,你的控制檯會出現什麼錯誤。 – iSpark

回答

1

有時這種錯誤出現,因爲連接的一個IBOutlet到IB,然後刪除該實例變量。檢查所有IBOutlet連接是否正確。

然後檢查您的視圖控制器的viewDidLoad,viewWillAppearviewDidAppear方法中是否有任何錯誤代碼。

+0

我是一個真正的初學者,所以我不知道Objective-C的所有單詞,所以..我應該發佈一些更多的代碼給你嗎? –