how to get location(coordinates) from city name in iphone sdk?-Collection of common programming errors
-
There is no geocoding API. You need to ask Google: http://maps.googleapis.com/maps/api/geocode/json?address=YOURADDRESS&sensor=true and parse the result using JSONKit.
Something like this:
-(CLLocation*) geocodeAddress:(NSString*) address { NSLog(@"Geocoding address: %@", address); // don't make requests faster than 0.5 seconds // Google may block/ban your requests if you abuse the service double pause = 0.5; NSDate *now = [NSDate date]; NSTimeInterval elapsed = [now timeIntervalSinceDate:self.lastPetition]; self.lastPetition = now; if (elapsed>0.0 && elapsed
Originally posted 2013-11-09 23:32:09.