AnsweredAssumed Answered

gps on simulator crashes

Question asked by fauphi on Nov 5, 2012
Latest reply on Nov 6, 2012 by fauphi
Hi,

The following problem appears only in the iPhone simulator of xcode, on a real device it works!

I set up a mapView and display a map. This works absolutely fine, but when I try to start the gps with [self.mapView.gps start] the application crashes with the following error:

*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'


Has this something to do with different spacial references? The map is in GK4.


If someone has a little hint for, that would be very helpful!:)

Here is my code:

// static variables NSString* passauStreetMapUrl = @"http://www.geoportal.passau.de/ArcGIS/rest/services/STADTPLAN/MapServer"; NSString* passauAirMapUrl = @"http://www.geoportal.passau.de/ArcGIS/rest/services/LUFTBILD/MapServer"; NSString* passauPoiLayerUrl = @"http://www.geoportal.passau.de/ArcGIS/rest/services/APPDATEN/MapServer"; NSString* worldMapUrl = @"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer";  - (void)viewDidLoad {     [super viewDidLoad];  // Do any additional setup after loading the view.              //set this class as the delegate for the mapview     self.mapView.layerDelegate = self;              //set wrap around vor the world map view     self.mapView.wrapAround = YES;          //create url     NSURL* urlPassauMap = [NSURL URLWithString: passauStreetMapUrl];     NSURL* urlPassauPoiLayer = [NSURL URLWithString: passauPoiLayerUrl];          //create tiled(PassauAirMap) and dynamic(PassauMap with layers) maps     self.layerPassauMap = [AGSDynamicMapServiceLayer dynamicMapServiceLayerWithURL: urlPassauMap];     self.layerPassauPoi = [AGSDynamicMapServiceLayer dynamicMapServiceLayerWithURL: urlPassauPoiLayer];          //add maps to view     UIView<AGSLayerView>* lyrView = [self.mapView addMapLayer:self.layerPassauMap withName:@"layerPassauMap"];     lyrView = [self.mapView addMapLayer:self.layerPassauPoi withName:@"layerPassauPoi"];          //set certain layers of the PassauMap to visible     self.layerPassauPoi.visibleLayers = [NSArray arrayWithObjects:[NSNumber numberWithInt:0], nil];          //better user experience on zooming and panning     lyrView.drawDuringPanning = YES;     lyrView.drawDuringZooming = YES; }


-(void) mapViewDidLoad:(AGSMapView*)mapView {     NSLog(@"INFO: mapViewDidLoad");   [self.mapView.gps start];           if (!mapView.gps.enabled) {   NSLog(@"The GPS is not enabled");  }  else if (mapView.gps.enabled) {   NSLog(@"The GPS is enabled");     }     }

Outcomes