xcode 3.2 - 按下按钮时app崩溃

时间:2013-10-05 19:46:38

标签: ios objective-c xcode

我正在构建一个简单的应用程序 - RadioStations,用于实例和类方法(Objective C的绝对初学者练习之一)。一切都很完美,没有调试器错误。在模拟中按下按钮后,应用程序崩溃了。练习是为Xcode 4编写的,我正在运行3.2,我怀疑, @synthesize 缺失但是很难添加它。 这是我在日志中得到的

  

23个RadioStations 0x00001d11 start + 53       24 ??? 0x00000001 0x0 + 1   “在抛出'NSException'实例后终止调用

感谢您的任何建议!

我的viewController.m文件低于

#import "RadioStationsViewController.h"
#import "RadioStation.h"


@implementation RadioStationsViewController


#pragma mark - View lifecycle 
- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view, typically from a nib. 
    myStation = [[RadioStation alloc] initWithName:@"STAR 94" 
                                       atFrequency:94.1]; 
}



 // The designated initializer. Override to perform setup that is required before the view is loaded.
 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
 self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
 if (self) {
 // Custom initialization
 }
 return self;
 }


/*
 // Implement loadView to create a view hierarchy programmatically, without using a nib.
 - (void)loadView {
 }
 */


/*
 // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
 - (void)viewDidLoad {?>,m
 [super viewDidLoad];
 }
/*


/*
 // Override to allow orientations other than the default portrait orientation.
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 // Return YES for supported orientations
 return (interfaceOrientation == UIInterfaceOrientationPortrait);
 }
 */

- (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;
}


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

- (IBAction)buttonClick:(id)sender { 
    [stationName setText:[myStation name]]; 
    [stationFrequency setText:[NSString stringWithFormat:@"%.1f", 
                               [myStation frequency]]]; 
    if (([myStation frequency] >= [RadioStation minFMFrequency]) && 
        ([myStation frequency] <= [RadioStation maxFMFrequency])) { 
        [stationBand setText:@"FM"]; 
    } else { 
        [stationBand setText:@"AM"]; 
    } 
}


@end

宣言.h吼叫

#import <UIKit/UIKit.h>


@class RadioStation; 

@interface RadioStationsViewController : UIViewController 
{ 
    RadioStation *myStation; 
    IBOutlet UILabel* stationName; 
    IBOutlet UILabel* stationFrequency; 
    IBOutlet UILabel* stationBand; 

} 

- (IBAction)buttonClick:(id)sender; 



@end

0 个答案:

没有答案