HusseinB
HusseinB

Reputation: 1341

extracting street name using reverse geocoding (Google API)

i'm using Google reverse geocoding to get the user's current location. my code goes like this:

    NSString* StrCurrentLongitude=[NSString stringWithFormat: @"%f", currentLocation.coordinate.longitude]; // string value

    NSString* StrCurrentLatitude=[NSString stringWithFormat: @"%f", currentLocation.coordinate.latitude];

    [NSURL URLWithString:[NSString stringWithFormat:@"http://maps.googleapis.com/maps/api/geocode/json?latlng=%@,%@&sensor=true_or_false",StrCurrentLatitude,StrCurrentLongitude]];

now how do i continue from here to get the user's current location?

Upvotes: 0

Views: 627

Answers (1)

Daij-Djan
Daij-Djan

Reputation: 50099

of the top of my head:

[NSURLConnection sendAsynchronousRequest:[NSURLRequest requestWithUrl:yourURL] queue:[NSOperationQueue mainQueue] completion:^(NSURLResponse *r, NSData *d, NSError *e) {
    //decode it
    id json = [NSJSONSerialization JSONObjectWithData:d options:0 error:nil]; 

    //process google response, which is JSON IIRC
}];

Upvotes: 1

Related Questions