2015-04-04 57 views
0

我目前正在通过#Augmented Reality完成Ray Wenderlich iOS教程,并且遇到了有关在MainViewController接口中找不到setLocationManger的问题?我该如何解决它?iOS编译错误:'setLocationManager'无法显示@interface声明选择器

我不明白,因为我认为这包括在CoreLocation/Corelocation.h类中。

#import "MainViewController.h" 
#import <MapKit/MapKit.h> 
#import <CoreLocation/CoreLocation.h> 
@interface MainViewController() <CLLocationManagerDelegate, MKMapViewDelegate> 

@property (weak, nonatomic) IBOutlet MKMapView *mapViewPointer; 
@property (nonatomic, strong) CLLocationManager *locationManagerPointer; 

@end 

@implementation MainViewController 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    // Roll Tide 

    [self setLocationManager:[[CLLocationManager alloc] init]]; 
    [_locationManagerPointer setDelegate:self]; 
    [_locationManagerPointer setDesiredAccuracy:kCLLocationAccuracyNearestTenMeters]; 
    [_locationManagerPointer startUpdatingLocation]; 
+0

提供完整的错误说明和车道上发生错误的点。 – 2015-04-04 08:16:25

回答

1

@property (nonatomic, strong) CLLocationManager *locationManagerPointer;

要么改名locationManagerPointerlocationManager或致电二传手作为

[self setLocationManagerPointer:[[CLLocationManager alloc] init]];

在声明属性设置器,并自动创建干将。

如果您的财产声明为@property NSString *userName,则将创建一个方法为setUserName和getter userName的设置器。您可以通过[self setUserName:@"fooBar"][self userName]访问它们。您的错误原因是您的物业名称与您的物业名称不同。

相关问题