AnsweredAssumed Answered

Map view will not autopan to location, or show location, unless app is run from Xcode

Question asked by shriver53 on Jun 1, 2015

The app I'm working on will load a map view and set an extent that includes all of the user's waypoints (features they've added to the map). But if the user hasn't added any waypoints it should go to the user's location, if available. In that instance I set the locationDisplay's autoPan mode to the default mode. When I build and run the app with Xcode it works. If I stop the app, then launch it from the springboard there is no zooming or panning and the location isn't shown. The app is set to request while-in-use permission for the location services.

This seems similar to this post.

Any ideas?

The code

-(void)mapViewDidLoad:(AGSMapView*)mapView
{
     [self.mapView.locationDisplay startDataSource]
     
     if(USER HAS WAYPOINTS)
     {
     // use waypoints to create extent, zoom to extent
     }
     else
     {    // no waypoints, so use current location, and autopan
      self.mapView.locationDisplay.autoPanMode = AGSLocationDisplayAutoPanModeDefault;
     }
}

Outcomes