我在我的应用中使用googlemaps来显示用户的当前位置..
这是我的代码:
self.locationManger.requestWhenInUseAuthorization()
self.locationManger.requestAlwaysAuthorization()
var currentlocation: CLLocation!
if (CLLocationManager.authorizationStatus() == CLAuthorizationStatus.authorizedWhenInUse || CLLocationManager.authorizationStatus() == CLAuthorizationStatus.authorized){
currentlocation = locationManger.location
}
let camera = GMSCameraPosition.camera(withLatitude: currentlocation.coordinate.latitude, longitude: currentlocation.coordinate.longitude, zoom: 15)
mapView.camera=camera
mapView.isMyLocationEnabled = true
mapView.settings.myLocationButton = true
mapView.padding = UIEdgeInsets(top: 0, left: 0, bottom: 90, right: 0)
这就是我得到的:
问题是引脚不在我当前的实际位置..如截图所示..我当前位置在红色圆圈中,而黄色圆圈中的引脚...我做错了什么?< / p>