我添加了 CoreLocation 框架,并不断重读书中的代码,以确保我正确地将其复制下来,但我遇到了一个持续性No visible @interface for 'CLLocation' declares the selector '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