-
Notifications
You must be signed in to change notification settings - Fork 2
Geocoding
aferre edited this page Jun 4, 2011
·
13 revisions
cf Google Geocoding API page for the behaviour of the WS.
Just copy afGMapsGeocodingRequest and afGoogleMapsAPIRequest files to your project (you need both ASIHTTP and JSON frameworks for the wrapper to work).
Create a request: afGMapsGeocodingRequest *req =[afGMapsGeocodingRequest geocodingRequest];
`req.afDelegate = self;`
`[req setUseSensor:YES];`
`[req setUseHTTPS:YES];`
`[req setLatlng:self.latlngTF.text];`
`[req startAsynchronous];`
Then, simply make your class inherit the afGoogleMapsGeocodingDelegate protocol, and implement the following delegate functions:
-(void) afGeocodingWSStarted:(afGMapsGeocodingRequest *)ws;
-(void) afGeocodingWS:(afGMapsGeocodingRequest *)ws gotAdress:(NSString *) dist;
-(void) afGeocodingWS:(afGMapsGeocodingRequest *)ws gotCoordinates:(NSString *) coord;
-(void) afDistanceWSFailed:(afGMapsDistanceRequest *)ws withError:(NSString *)er;