AGSLocationDisplay doesn't auto-pan to current location, or show location, unless app is built and run with Xcode

2452
0
06-02-2015 06:56 AM
DanShriver
New Contributor

When the iOS app I'm working on launches it initializes a map view that zooms to an extent which will show all of the locations (waypoints) the user has added to their account. If the user has no waypoints added the map should auto-pan to the current location, but this only happens when I build and run the app with Xcode. If I launch the app on the device (iPad Air) from the home screen the map will not show the current location and since there's no location, it won't auto-pan. The app will work fine on an iPhone, but in that case the map isn't presented on the first screen, the user has to go to the map, and by that time the map view has loaded and its datasource has a location to work with. On the iPad the map is presented right away.

Sometimes if I wait several minutes the map will suddenly auto-pan to the location, as if the AGSLocationDisplay's datasource had just gotten a location to work with. I'm wondering if this behavior may be related to the wi-fi network I'm using here at work, which is behind a proxy (the iPad is wi-fi only, the iPhone has a cellular data plan). Some of the behavior I've seen seems similar to this post. Anyone have any ideas?

EDIT: Actually, the map does not work correctly on the iPhone. On the phone the app flips between the map and a table view. The first time the map is loaded it will auto-pan fine. After that if you go to the table view and then back to the map the map will show the current location but usually won't auto-pan and is zoomed all the way out, sometimes it will auto-pan, but mostly it won't.

The code is pretty simple:

-(void)mapViewDidLoad:(AGSMapView*)
{
     if(user has waypoints)
     {     
         map will zoom to extent of waypoints
     }
     else
     {
           self.mapView.locationDisplay.autoPanMode = AGSLocationDisplayAutoPanModeDefault;
     }
}

Message was edited by: Dan Shriver

0 Kudos
0 Replies