저는 http://www.switchonthecode.com/tutorials/getting-your-location-in-an-iphone-application 자습서를 따르고 있습니다.하지만 Xcode SDK에서 위도와 경도를 구할 수 없습니다.위도 경도 IOS 4.3
- (void)viewDidLoad {
[super viewDidLoad];
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
[locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
int degrees = newLocation.coordinate.latitude;
double decimal = fabs(newLocation.coordinate.latitude - degrees);
int minutes = decimal * 60;
double seconds = decimal * 3600 - minutes * 60;
NSString *lat = [NSString stringWithFormat:@"%d° %d' %1.4f\"",
degrees, minutes, seconds];
//latLabel.text = lat;
degrees = newLocation.coordinate.longitude;
decimal = fabs(newLocation.coordinate.longitude - degrees);
minutes = decimal * 60;
seconds = decimal * 3600 - minutes * 60;
NSString *longt = [NSString stringWithFormat:@"%d° %d' %1.4f\"",
degrees, minutes, seconds];
NSLog(@"%@ %@",longt, lat);
}
콘솔에서 위도와 경도를 표시하지 않습니다. 도와주세요.
: 여기
이 방법의 예는 델리게이트 메소드'locationManager : didFailWithError :'를 구현하고 있습니까? 그렇다면 오류가 있습니까? 그렇지 않다면 구현하고 오류가 있는지 확인하십시오. – mattjgalloway
코드는 바로 나를 위해 박쥐에서 작동합니다. 단일보기 앱에서. 앱에서 현재 위치를 사용하도록 요청하면 확인을 클릭 했습니까? – markhunte
아, 방금 iOS5를 사용하고 있다는 것을 깨달았습니다. 당신은 점점 : 서버가 클라이언트 등록을 받아들이지 않았습니다. 68. 콘솔에서 – markhunte