Reputation: 1341
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
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