2010-12-04 9 views
0

で宣言された変数にinit私が取得しています奇妙なエラー:私の.mファイル内viewDidLoad方法に客観C:私はこの行を追加したときに、私のヘッダファイル

locMan = [[CLLocationManager alloc] init]; 

を私は持っている若干の誤差が出ます以前は見たことがない。ここでのエラーは、次のとおり追加し、その行が問題の原因になっている理由

alt text

私は私の人生のために把握することはできません。誰かが少し光を当てることができるなら、私はとても感謝しています。

#import <UIKit/UIKit.h> 
#import "CoreLocation/CoreLocation.h" 


@interface RobotWarsViewController : UIViewController 
<CLLocationManagerDelegate> { 

    CLLocationManager *locMan; 

    // Current Location View 
    IBOutlet UIView *currentLocationView; 
    IBOutlet UILabel *currentLocationLabel; 


} 

@property (assign, nonatomic) UIView *currentLocationView; 
@property (assign, nonatomic) UILabel *currentLocationLabel; 
@property (assign, nonatomic) CLLocationManager *locMan;       

- (IBAction)dropEMP:(id)sender; 
- (IBAction)armEMP:(id)sender; 

@end 

そして、この.mファイル:

#import "RobotWarsViewController.h" 

@implementation RobotWarsViewController 


@synthesize locMan; 
@synthesize currentLocationView; 
@synthesize currentLocationLabel; 

- (void)viewDidLoad { 
    [super viewDidLoad]; 

    locMan = [[CLLocationManager alloc] init]; 
// locMan.delegate = self; 

} 

- (IBAction)dropEMP:(id)sender{ 

    NSLog(@"Boo"); 

} 

- (IBAction)armEMP:(id)sender{ 

    NSLog(@"boo"); 

} 

- (void)locationManager:(CLLocationManager *)manager 
    didUpdateToLocation:(CLLocation *)newLocation 
      fromLocation:(CLLocation *)oldLocation { 

    NSLog(@"location update"); 

} 



- (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]; 
    [currentLocationView release]; 
    [currentLocationLabel release]; 

} 

@end 

答えて

3

CoreLocationフレームワークをプロジェクトに追加しましたか?

Frameworksグループを展開し、そこにCoreLocationがリストされているかどうかを確認してください。そうでない場合は、右クリックして追加します。

+0

ありがとう、ありがとう、ありがとう! – sixtyfootersdude

2

あなたは、あなたのプロジェクトにCoreLocationフレームワークを追加しなかった

私はこのヘッダファイルを持っています。

関連する問題