對於Objective-C來說,我相當新,我試圖找到用戶的位置。下面是我的,但有一個解析問題(![cLLocationManager locationServicesEnabled])
。CLLocationManager locationServicesEnabled ios6
我認爲它已被棄用的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;
}
}
任何幫助將不勝感激。
我看到您更新了您的問題中的原始代碼並進行了必要的修復。這是不好的形式。現在如果有人看到你的問題和答案,那沒有任何意義。一旦提供答案,切勿修改原始問題。您可以添加到問題中,但不要修改原始文本。 – rmaddy