我添加了CoreLocation框架,並且不斷重讀我書中的代碼以確保我將它正確地複製下來,但是我得到持續的No visible @interface for 'CLLocation' declares the selector 'setDesiredAccuracy:'
錯誤。'CLLocation'沒有可見的@interface聲明選擇器'setDesiredAccuracy:'
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
@interface WhereamiViewController : UIViewController {
CLLocation *locationManager;
}
@end
#import "WhereamiViewController.h"
@interface WhereamiViewController()
@end
@implementation WhereamiViewController
-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
locationManager = [[CLLocation alloc] init
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
}
return self;
}
@end