*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'
// 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"); } }
Solved! Go to Solution.