0
我跟踪了一些在线文档here来设置Google地图API,我可以将其加载到视图中。我确实有一个问题 - 当我得到用户的位置时,Google地图的视图不会显示/捕捉/动画到用户的位置。我能够成功获取用户的位置。无法将googlemaps设置为用户活动位置swift
我的位置经理:
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]){
let newUserLocation: CLLocation = locations[0]
let latitude: CLLocationDegrees = newUserLocation.coordinate.latitude
let longitude: CLLocationDegrees = newUserLocation.coordinate.longitude
userLocation = PFGeoPoint(latitude:latitude, longitude:longitude)
let Camera = GMSCameraPosition.camera(withLatitude: userLocation.latitude, longitude: userLocation.longitude, zoom: 15)
self.MapView.isMyLocationEnabled = true
self.MapView = GMSMapView.map(withFrame: CGRect.zero , camera: Camera)
}
我viewDidLoad中:
override func viewDidLoad() {
super.viewDidLoad()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.requestAlwaysAuthorization()
locationManager.startUpdatingLocation()
}