Там нет родной путь в Google Maps API IOS SDK. Как уже упоминалось в других ответах, это было requested feature for years.
Следует помнить, что API Карт Google в основном ориентирован на создание карт: это основная цель.
Вы должны использовать API-вызовы API или какую-либо другую услугу. Например, у другой службы под названием SmartyStreets есть SDK для iOS, у которого есть встроенная поддержка передового геокодирования. Вот пример кода для Swift из their iOS SDK documentation page:
// Swift: Sending a Single Lookup to the US ZIP Code API
package examples;
import Foundation
import SmartystreetsSDK
class ZipCodeSingleLookupExample {
func run() -> String {
let mobile = SSSharedCredentials(id: "SMARTY WEBSITE KEY HERE", hostname: "HOST HERE")
let client = SSZipCodeClientBuilder(signer: mobile).build()
// Uncomment the following line to use Static Credentials
// let client = SSZipCodeClientBuilder(authId: "YOUR AUTH-ID HERE", authToken: "YOUR AUTH-TOKEN HERE").build()
let lookup = SSZipCodeLookup()
lookup.city = "Mountain View"
lookup.state = "California"
do {
try client?.send(lookup)
} catch let error as NSError {
print(String(format: "Domain: %@", error.domain))
print(String(format: "Error Code: %i", error.code))
print(String(format: "Description: %@", error.localizedDescription))
return "Error sending request"
}
let result: SSResult = lookup.result
let zipCodes = result.zipCodes
let cities = result.cities
var output: String = String()
if (cities == nil && zipCodes == nil) {
output += "Error getting cities and zip codes."
return output
}
for city in cities! {
output += "\nCity: " + (city as! SSCity).city
output += "\nState: " + (city as! SSCity).state
output += "\nMailable City: " + ((city as! SSCity).mailableCity ? "YES" : "NO") + "\n"
}
for zip in zipCodes! {
output += "\nZIP Code: " + (zip as! SSZipCode).zipCode
output += "\nLatitude: " + String(format:"%f", (zip as! SSZipCode).latitude)
output += "\nLongitude: " + String(format:"%f", (zip as! SSZipCode).longitude) + "\n"
}
return output
}
}
Полное раскрытие: Я работал на SmartyStreets.