{"id":1144,"date":"2022-08-30T15:13:07","date_gmt":"2022-08-30T15:13:07","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/how-to-get-locationcoordinates-from-city-name-in-iphone-sdk-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:13:07","modified_gmt":"2022-08-30T15:13:07","slug":"how-to-get-locationcoordinates-from-city-name-in-iphone-sdk-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/how-to-get-locationcoordinates-from-city-name-in-iphone-sdk-collection-of-common-programming-errors\/","title":{"rendered":"how to get location(coordinates) from city name in iphone sdk?-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li>\n<p>There is no geocoding API. You need to ask Google: http:\/\/maps.googleapis.com\/maps\/api\/geocode\/json?address=YOURADDRESS&amp;sensor=true and parse the result using JSONKit.<\/p>\n<p>Something like this:<\/p>\n<pre><code>-(CLLocation*) geocodeAddress:(NSString*) address {\n\n    NSLog(@\"Geocoding address: %@\", address);\n\n    \/\/ don't make requests faster than 0.5 seconds\n    \/\/ Google may block\/ban your requests if you abuse the service\n    double pause = 0.5;\n    NSDate *now = [NSDate date];\n    NSTimeInterval elapsed = [now timeIntervalSinceDate:self.lastPetition];\n    self.lastPetition = now;\n    if (elapsed&gt;0.0 &amp;&amp; elapsed<\/code><\/pre>\n<\/li>\n<\/ul>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:32:09. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>There is no geocoding API. You need to ask Google: http:\/\/maps.googleapis.com\/maps\/api\/geocode\/json?address=YOURADDRESS&amp;sensor=true and parse the result using JSONKit. Something like this: -(CLLocation*) geocodeAddress:(NSString*) address { NSLog(@&#8221;Geocoding address: %@&#8221;, address); \/\/ don&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1144","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1144"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1144\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}