-1

私はシンプルなアプリを構築しています.RadioStationsは、インスタンスとクラスのメソッドで遊ぶことができます. すべてが完全に機能し、デバッガー エラーは発生しません。シミュレーションでボタンを押すと、アプリがクラッシュします。この演習は Xcode 4 用に書かれており、私は 3.2 を実行しています。 @synthesizeが見つからないのですが、追加するのに苦労しています。これは私がログに記録するものです

23 ラジオステーション 0x00001d11 開始 + 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
4

0 に答える 0