ios - extracting street name using reverse geocoding (Google API) -
i'm using google reverse geocoding user's current location. code goes 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 continue here user's current location?
of top of head:
[nsurlconnection sendasynchronousrequest:[nsurlrequest requestwithurl:yoururl] queue:[nsoperationqueue mainqueue] completion:^(nsurlresponse *r, nsdata *d, nserror *e) { //decode id json = [nsjsonserialization jsonobjectwithdata:d options:0 error:nil]; //process google response, json iirc }];
Comments
Post a Comment