There's a sample provided by esri named GpsSample (I can't find a way to upload it here)

Anyway, the sample includes multiple selections for mapview's locationDisplay autoPanMode property

I'm trying to implement it in a similar way, my code is the same, difference is I'm creating the UI controls dynamically (mapview included) without relying on static XIBs

Debugging the code, the autoPanMode property for the map changes correctly but the mapview still wouldn't be automatically rotated like in the provided sample

Finally, I set mapview's allowRotatingByPinching to YES, the map and attached compass image are rotating correctly via pinching. But still wouldn't automatically rotate itself.


Try setting the autoPanMode property to either AGSLocationDisplayAutoPanModeNavigation or AGSLocationDisplayAutoPanModeCompassNavigation because, according to the docs, those should rotate the map.

Also beware that panning or zooming the map will turn off autoPanMode.

  • i'm setting the autoPanMode accordingly, the values are set correctly for autoPanMode and location updates and i made sure of it through debugging & break points it's the mapview that can't sense any of the changes it wouldn't draw a location symbol, it wouldn't zoom to the location and it wouldn't rotate by itself – Ahmed Elashker Jan 28 '15 at 17:48
  • Are you using compass navigation on a real device with a calibrated compass? The compass (magnetometer) doesn't work on the simulator and on device it must be calibrated. To find out if compass is calibrated, check to see if headingAccuracy field is greater than 0 in the CLHeading object you get from locationManager:didUpdateHeading:. Also make sure the device supports the compass with +headingAvailable method. – progrmr Jan 29 '15 at 2:33
  • If you're not even getting the location symbol on the map then the problem is not just the compass. Something else is wrong. Is the code running on iOS 8? Did the code request permission to get location using requestWhenInUseAuthorization? – progrmr Jan 29 '15 at 2:36

I found out what was wrong

I set locationDisplay.dataSource.Delegate to self, and it was causing all these issues

Using the locationDisplayDataSourceDelegate methods, I was receiving location and heading updates without any trouble. Yet it appears that I also had to implement a way to draw the symbol and handle the map view responses to the autoPanMode

I think it'll be easier to keep it this way and create another location manager instance to receive location data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.