1
CLlocationManager 객체를 통해 Xcode에서 coreloaction 프레임 워크를 사용하여 현재 위치 이름을 가져 오려고합니다. 내 iPod touch에서 응용 프로그램을 테스트 할 때 CLlocationManager는 일부 장소에 대한 가치를 제공하지만 많은 곳에서 [null]을 반환합니다. 이 문제를 어떻게 해결할 수 있습니까? 다음 코드 작성을 도와주세요.CLLocationManager가 Xcode에서 지역에 대해 null을 반환합니다.
-(void)viewDidLoad
{
self.locationManager = [[CLLocationManager alloc] init] ;
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers;
[self.locationManager startUpdatingLocation];
}
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
CLGeocoder *geoCoder = [[CLGeocoder alloc]init];
[geoCoder reverseGeocodeLocation:newLocation completionHandler:^(NSArray *placemarks, NSError *error)
{
if(error)
{
NSLog(@"error:%@",[error localizedDescription ]);
NSLog(@"Check your inetconnection");
}
_placedetail=nil;
self.placedetail=[placemarks objectAtIndex:0];
self.Label.text=self.placedetail.locality;
}];
[manager stopUpdatingLocation];//for stop process update
}