尝试在xcode中打开新页面时出现SIGABRT错误

时间:2011-09-04 18:53:38

标签: iphone ios xcode xcode4 modalviewcontroller

我正在尝试测试我的应用程序,但是当我在模拟器或实际设备上测试时,我会让它在级别选择页面上启动应用程序,但是,当我尝试点击关卡时,我得到错误线程1:程序收到的信号:“SIGABRT”。我的代码中出现了转换样式的错误,当我尝试删除转换时,应用程序仍然会收到错误但是在不同的地方。关于如何解决这个问题的任何想法?这是我的代码:

MainViewController.h

#import "FlipsideViewController.h"
#import "MediumViewController.h"
#import "HardViewController.h"

@interface MainViewController : UIViewController <FlipsideViewControllerDelegate, MediumViewControllerDelegate, HardViewControllerDelegate> {
    UIButton *buttonEasy;
    UIButton *buttonMedium;
    UIButton *buttonHard;
}

@property (nonatomic, retain) IBOutlet UIButton *buttonEasy;
@property (nonatomic, retain) IBOutlet UIButton *buttonMedium;
@property (nonatomic, retain) IBOutlet UIButton *buttonHard;

- (IBAction)showEasy:(id)sender;
- (IBAction)showMedium:(id)sender;
- (IBAction)showHard:(id)sender;

@end

MainViewController.m

@implementation MainViewController

@synthesize buttonEasy;
@synthesize buttonMedium;
@synthesize buttonHard;

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

- (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller
{
    [self dismissModalViewControllerAnimated:YES];
}

- (void)MediumViewControllerDidFinish:(MediumViewController *)controller
{
    [self dismissModalViewControllerAnimated:YES];
}

- (void)HardViewControllerDidFinish:(HardViewController *)controller
{
    [self dismissModalViewControllerAnimated:YES];
}

- (IBAction)showEasy:(id)sender
{    
    FlipsideViewController *controller = [[FlipsideViewController alloc]     initWithNibName:@"FlipsideView" bundle:nil];
    controller.delegate = self;

    controller.modalTransitionStyle = UIModalTransitionStylePartialCurl;
    [self presentModalViewController:controller animated:YES];

    [controller release];
}

- (IBAction)showMedium:(id)sender
{
    MediumViewController *controller = [[MediumViewController alloc initWithNibName:@"MediumViewController" bundle:nil];
    controller.delegate = self;

    controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentModalViewController:controller animated:YES];

    [controller release];
}

- (IBAction)showHard:(id)sender
{
    HardViewController *controller = [[HardViewController alloc] initWithNibName:@"HardViewController" bundle:nil];
    controller.delegate = self;

    controller.modalTransitionStyle = UIModalTransitionStylePartialCurl;
    [self presentModalViewController:controller animated:YES];

    [controller release];
}

3 个答案:

答案 0 :(得分:0)

我建议你仔细检查你的NIB文件的名称,之前我有类似的经历,发现我拼错了NIB文件名。

答案 1 :(得分:0)

如果调试器控制台中没有更多信息,请尝试启用僵尸,因为它会告诉您是否存在内存问题:启用僵尸(Xcode 4)单击产品&gt;编辑方案&gt;运行(项目名称)&gt;环境变量添加:NSZombieEnabled。然后在值字段中为YES。清洁和重建。

答案 2 :(得分:0)

我建议您查看您的IB连接。如果您已经链接了一个Outlet,然后更改了它的名字,那么它就会崩溃