Я получаю, когда добавляю эту строку:
locMan = [[CLLocationManager alloc] init];
В методе viewDidLoad
внутри моего файла .m я получаю некоторые ошибки, которых я никогда раньше не видел Вот ошибки:
Я не могу понять, почему добавление этой строки вызывает проблемы. Если кто-то может пролить свет, я был бы очень благодарен.
У меня есть этот заголовочный файл:
#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