我正在使用以下代码进行反向地理编码
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
curLoc=newLocation;
if (curLoc != nil) {
latitude=curLoc.coordinate.latitude;
longitude=curLoc.coordinate.longitude;
//[self loadMap:latitude second:longitude];
[self MarkerPoint:latitude+0.04 second:longitude+0.1 third:latitude-0.04 forth:longitude-0.1];
NSError *error;
NSString *lookupString = [NSURL URLWithString:[NSString stringWithFormat:@"http://maps.googleapis.com/maps/api/geocode/json?latlng=%f,%f&sensor=false",latitude,longitude]];
NSLog(@"URL: %@",lookupString);
lookupString = [lookupString stringByReplacingOccurrencesOfString:@" " withString:@"+"];
NSData *jsonResponse = [NSData dataWithContentsOfURL:[NSURL URLWithString:lookupString]];
NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:jsonResponse options:kNilOptions error:&error];
self.locationArray = [[jsonDict valueForKey:@"results"] valueForKey:@"formatted_address"];
int total = self.locationArray.count;
NSLog(@"locationArray count: %d", self.locationArray.count);
for (int i = 0; i < total; i++)
{
NSString *statusString = …Run Code Online (Sandbox Code Playgroud)