应用程序运行一秒钟,然后立即关闭

时间:2012-09-21 13:15:05

标签: ios xcode

这是一个非常基本的应用程序。编译时,显示“Build Successful”(“No issues”)。当我单击模拟器中的应用程序图标时,它会运行一秒钟,然后自动关闭。我可以看到没有错误(比如运行时错误)。我应该在哪里寻找提示?

ClickButtonViewController.m文件:

    #import "ClickButtonViewController.h"

@implementation ClickButtonViewController;



@synthesize decisionText ; 

-(IBAction)buttonPressed:(id)sender 
{
    decisionText.text = @"Go for it!" ;
}

-(void)dealloc{
    [decisionText release];
    [super dealloc] ; 

}



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

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

- (void)viewDidUnload {
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}




@end

ClickButtonViewController.h文件:

#import <UIKit/UIKit.h>

@interface ClickButtonViewController : UIViewController {

    IBOutlet UILabel *decisionText ; 

}

@property (nonatomic,retain) IBOutlet UILabel *decisionText ;

-(IBAction)buttonPressed:(id)sender; 


@end

1 个答案:

答案 0 :(得分:0)

Build不会将应用程序安装到模拟器,您需要运行目标。

如果您选择了不可运行的目标(例如静态库),则运行选项将执行构建。