我对 Objective-C 相当陌生,我试图找到用户的位置。以下是我所拥有的,但存在解析问题(![cLLocationManager locationServicesEnabled])
。
我认为它已被 iOS6 弃用,但我找不到改用什么。
- (void)updateLabels {
if (location != nil) {
self.latitudeLabel.text = [NSString stringWithFormat:@"%.8f",location.coordinate.latitude];
self.longitudeLabel.text = [NSString stringWithFormat:@"%.8f",location.coordinate.longitude];
} else {
self.longitudeLabel.text = @"";
self.latitudeLabel.text = @"";
NSString *statusMessage;
if ([lastLocationError.domain isEqualToString:kCLErrorDomain] && lastLocationError.code == kCLErrorDenied) {
statusMessage = @"Location Services Disabled";
} else {
statusMessage = @"Error Getting Location";
} else if (![CLLocationManager locationServicesEnabled]) { //Problem lies here
statusMessage = @"Location Services Disabled";
} else if (updatingLocation) {
statusMessage = @"Searching...";
} else {
statusMessage = @"Press the Button to start";
}
self.messageLabel.text = statusMessage;
}
}
任何帮助都感激不尽。