我试图用 Xcode 制作一个 iOS 应用程序,直到现在一切正常。我在 MainWindow.xib 上有一个导航控制器,首先它加载了 RootViewController NIB,但现在我将其更改为 main,因为我之前想要一个启动屏幕。但是现在该应用程序在启动时崩溃并出现错误“SIGABRT”。线程 1 0 中止:
0x99771bdd <+0167> jmp 0x99771c0c <abort+214>
在 11 UIApplicationMain 它是:
0x0036da9b <+1175> xor %eax,%eax
在 main.m 中:
int retVal = UIApplicationMain(argc, argv, nil, nil);
它停止的地方。
新文件:StartScreen.h:
#import <UIKit/UIKit.h>
#import "RootViewController.h"
@interface StartScreen : UIViewController {
RootViewController *rootViewController;
IBOutlet UIButton *showList;
}
@property(nonatomic, retain) RootViewController *rootViewController;
@end
开始屏幕.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
出现开机画面1秒后app直接关机....
(另一个问题是,在此错误出现之前,在模拟器中关闭并重新启动应用程序后出现错误“SIGKILL”)
请帮忙 :)