簡體   English   中英

iOS編譯錯誤:“ setLocationManager”沒有可見的@interface聲明選擇器

[英]iOS compile error: No visible @interface for 'setLocationManager' declares the selector

我目前正在#Augmented Reality上完成Ray Wenderlich iOS教程,並且遇到一個問題,涉及在MainViewController界面中找不到setLocationManger? 我該如何解決?

我不明白,因為我認為這已包含在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];

@property (nonatomic, strong) CLLocationManager *locationManagerPointer;

locationManagerPointer重命名為locationManager或將設置程序稱為

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

聲明屬性時,將自動創建setter和getter。

如果將屬性聲明為@property NSString *userName ,則將創建一個具有setUserName方法和getter userName方法的setter。 您可以使用[self setUserName:@"fooBar"][self userName]來訪問它們。 錯誤的原因是您的財產名稱不同於您的財產設定者。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM