0
我在制定我加入我的應用程序的視圖中的谷歌地圖,下面的教程我用這個代碼斯威夫特,乘坐附近的用戶位置的地方
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let location: CLLocation = locations.last!
print("Location: \(location)")
let camera = GMSCameraPosition.camera(withLatitude: location.coordinate.latitude,
longitude: location.coordinate.longitude,
zoom: zoomlevel)
let marker = GMSMarker()
marker.title = "My Position"
marker.map = mapView
if mapView.isHidden {
mapView.isHidden = false
mapView.camera = camera
} else {
mapView.animate(to: camera)
}
}
func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
switch status {
case .restricted:
print("Location access was restricted.")
case .denied:
print("User denied access to location.")
mapView.isHidden = false
case .notDetermined:
print("Location status not determined.")
case .authorizedAlways: fallthrough
case .authorizedWhenInUse:
print("Location status is OK.")
}
}
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
locationManager.stopUpdatingLocation()
print("Error: \(error)")
}
找到用戶初學者位置,現在我想在地圖上看到距用戶位置X距離的地方(谷歌地點),我該如何做?我搜索了谷歌的地方文件,但沒有找到有效的答案
這是你在找什麼:[https://stackoverflow.com/questions/44333550/get-list-of-nearby-places-from-google-places-api-swift-3]? ? – 2017-09-25 10:12:50