0
我使用此代碼從Google API獲取當前位置信息(國家 - 城市...等) 我的問題是,如何以阿拉伯語或其他語言獲得結果國名?其他語言的ReverGeoCodeLocation結果
請幫助
//
// ViewController.swift
// Geocoding
//
// Created by Moaaz Nash on 5/29/17.
// Copyright © 2017 Moaaz Nash. All rights reserved.
//
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let camera = GMSCameraPosition.camera(withLatitude: -33.86, longitude: 151.20, zoom: 6.0)
let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
view = mapView
mapView.delegate = self
mapView.isMyLocationEnabled = true
if let mylocation = mapView.myLocation {
print("User's location: \(mylocation)")
} else {
print("User's location is unknown")
}
var longitude :CLLocationDegrees = 46.736228
var latitude :CLLocationDegrees = 24.756455
var location = CLLocation(latitude: latitude, longitude: longitude) //changed!!!
print(location)
CLGeocoder().reverseGeocodeLocation(location, completionHandler: {(placemarks, error) -> Void in
print(location)
if error != nil {
print("Reverse geocoder failed with error" + (error?.localizedDescription)!)
return
}