There is a extremely weird problem in my app. I am developing an app that records user's trail and draws them on a MKMapView (like Runkeeper). A person in Asia used this app, and the person reported that the MKPolylines on the MKMapViews actually render at wrong positions, at an offset of what the correct positions should be. When I tested this app in North America, the MKPolyline is not rendered wrongly. Is this because the conversion between CLLocationCoordinate2D and MKMapPoint is inaccurate? Does it have to do with the 180 meridian thingies? Thank you so very much.
Code (I could not really find what is wrong in this code, but maybe you can?):
func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
//...
addLocationsToTrail(locations as [CLLocation])
updateOverlay()
}
func addLocationsToTrail(locations: [CLLocation]) {
for location in locations {
locationsInTrailRecorded.addLocationToTrail(location)
}
}
func updateOverlay() {
let newOverlay = PolylineOverlayFactory.createPolylineOverlayFromLocations(locationsInTrailRecorded) //Returns MKPolyline
let oldOverlay = self.trailOverlay
mapView.addOverlay(newOverlay, level: .AboveRoads)
mapView.removeOverlay(oldOverlay)
self.trailOverlay = newOverlay
}