我尝试让 locationServicesEnabled 功能正常工作......但无论 locationServices 是否启用,我的 UIAlert 都会显示!我怎样才能让它正常工作?
@synthesize locationServicesEnabled
-(void)viewDidLoad {
[super viewDidLoad];
if(![CLLocationManager locationServicesEnabled]) {
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
} else {
[[[[UIAlertView alloc] initWithTitle:@"Location services."
message:@"Location services are disabled."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] autorelease] show];
}
}
先感谢您!