PDA

View Full Version : Doesn't open up in iPhone Simulator




DIGITALiam
Jul 23, 2010, 12:25 PM
Hey I'm writing a basic timer app for learning purposes. When I try to build and run it in the simulator, it crashes right away. I assume it is a memory problem but some guidance would be great. Here is the only code I have written so far.

MainViewController.h

#import "FlipsideViewController.h"

@interface MainViewController : UIViewController <FlipsideViewControllerDelegate> {
IBOutlet UILabel *UIsecondTime;
IBOutlet UILabel *UIminuteTime;
IBOutlet UILabel *UIstate;

NSTimer *myTicker;

int secondTime;
int minuteTime;
int state;
}
@property(nonatomic,retain) UILabel* UIsecondTime;
@property(nonatomic,retain) UILabel* UIminuteTime;
@property(nonatomic,retain) UILabel* UIstate;

- (IBAction)showInfo:(id)sender;
- (IBAction)startTimer;
- (void)stateAndTime;


@end




MainViewController.m
#import "MainViewController.h"


@implementation MainViewController

@synthesize UIsecondTime;
@synthesize UIminuteTime;
@synthesize UIstate;

int secondTime = 00;
int minuteTime = 00;
int state = 0;





- (IBAction)startTimer{

myTicker = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(stateAndTime) userInfo:nil repeats:YES];

}

- (void)stateAndTime{
secondTime = secondTime - 1;
UIsecondTime.text = [NSString stringWithFormat:@"%d", secondTime];
}

...
@end



dejo
Jul 23, 2010, 12:40 PM
When I try to build and run it in the simulator, it crashes right away.
Do you get any run-time errors? Have you looked at the crash report? Also, keep this in mind: Getting Answers (http://www.mikeash.com/getting_answers.html)

DIGITALiam
Jul 23, 2010, 01:49 PM
Sorry I didn't clarify enough.

There is no errors. I don't exactly know what the crash report is or how to get it and my quick google search didn't come up with anything.

dejo
Jul 23, 2010, 02:05 PM
Debugging Applications (http://developer.apple.com/iphone/library/documentation/xcode/conceptual/iphone_development/130-Debugging_Applications/debugging_applications.html)

DIGITALiam
Jul 23, 2010, 03:30 PM
Thanks.

I fixed it. I couldn't figure it out but I copied and pasted the code into a new XCode project.