fredrik@glawe.se

Two questions

Discussion created by fredrik@glawe.se on Aug 30, 2011
Latest reply on Aug 31, 2011 by njarecha-esristaff
Hello,

I have two questions.

The first one is. When im running the line: [self.mapView showCalloutAtPoint:calloutPoint]; i get a crash with the following error:
Test[90839:10403] CoreAnimation: ignoring exception: CALayer position contains NaN: [nan nan]
Test[90839:10403] *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'

Second question is that i get the wrong position when using mapUrl2. Any clue why ?

-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
   
    NSURL *mapUrl = [NSURL URLWithString:@"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"];
    //NSURL *mapUrl2 = [NSURL URLWithString:@"http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"];

    AGSTiledMapServiceLayer *tiledLayer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:mapUrl];
    [self.mapView addMapLayer:tiledLayer withName:@"Test"];
   
   
    _longitude = 18.0867791176; //For testing
    _latitude  = 59.3319417452; //For testing
    double size = 0.01;
  AGSEnvelope *env =   [AGSEnvelope envelopeWithXmin:_longitude - size ymin:_latitude - size xmax:_longitude + size ymax:_latitude + size spatialReference:self.mapView.spatialReference];
    AGSPoint *calloutPoint = [AGSPoint pointWithX:_longitude y:_latitude spatialReference:self.mapView.spatialReference];
    [self.mapView zoomToEnvelope:env animated:YES];
    self.mapView.callout.title = @"title";
    self.mapView.callout.detail = @"detail";
    //[self.mapView showCalloutAtPoint:calloutPoint];
}

Outcomes