사용자 위치를 찾아 레이블로 반환하는 코드가 있습니다. 경우에 따라 subAdministrativeArea를 사용할 수 없거나 도로 정보가 표시되지 않으므로 문자열을 수정하려고합니다 (null). 나는 이것을 체크하기 위해 노력했지만, (null)이 둘 이상일 경우 문제가있다. 누구나 이것에 대해 생각해 봤어?locationManager 레이블에 피하기 (null) 문자열
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
CLLocation *currentLocation = newLocation;
[location stopUpdatingLocation];
[geocoder reverseGeocodeLocation:currentLocation completionHandler:^(NSArray *placemarks, NSError *error) {
if (error == nil && [placemarks count] > 0) {
placemark = [placemarks lastObject];
countryDetected = placemark.ISOcountryCode;
placeLabel.text = [NSString stringWithFormat:@"%@, %@, %@, %@, %@ %@", placemark.country, placemark.subAdministrativeArea, placemark.subLocality, placemark.postalCode, placemark.thoroughfare, placemark.subThoroughfare];
userPlace = [NSString stringWithFormat:@"%@, %@, %@, %@, %@ %@", placemark.country, placemark.subAdministrativeArea, placemark.subLocality, placemark.postalCode, placemark.thoroughfare, placemark.subThoroughfare];
} else {
NSLog(@"%@", error.debugDescription);
}
} ];
}
안녕하세요, 정중하게 질문하십시오. 도움이 될 것입니다 .. –