self.mapView.layerDelegate = self; //create an instance of a tiled map service layer AGSTiledMapServiceLayer *tiledLayer = [[AGSTiledMapServiceLayer alloc] initWithURL:[NSURL URLWithString:kTiledMapServiceURL]]; //Add it to the map view [self.mapView addMapLayer:tiledLayer withName:@"Tiled Layer"]; //release to avoid memory leaks //set the callout delegate so we can display callouts self.mapView.callout.delegate = self; //add graphics layer for the graphics self.graphicsLayer = [AGSGraphicsLayer graphicsLayer]; //add the graphics layer to the map [self.mapView addMapLayer:self.graphicsLayer withName:@"Graphics Layer"]; //zoom to china AGSEnvelope *chinaEnv = [AGSEnvelope envelopeWithXmin:78.0000000 ymin:0.4400000 xmax:156.0000000 ymax:75.0000000 spatialReference:[AGSSpatialReference wgs84SpatialReference]]; [self.mapView zoomToEnvelope:chinaEnv animated:YES]; self.mapView.callout.customView = nil; self.mapView.callout.accessoryButtonHidden = YES; double longitude = 116.929167; double latitude = 34.727222; AGSPoint *graphicPoint = [AGSPoint pointWithX:longitude y:latitude spatialReference:[AGSSpatialReference wgs84SpatialReference]]; [self.mapView.callout showCalloutAt:graphicPoint screenOffset:CGPointMake(0, 0) animated:YES];
Hi Somnus,
Welcome to Esri Forums! I see that this is your first post, thank you for posting your question here.
I'm not 100% sure what the issue is, but I would suggest watching the web traffic made by the application when the point is added to the map. See if the this can be done with the simulator and Fiddler, using this documentation:
Capture Traffic from iOS Device
http://fiddler2.com/documentation/Configure-Fiddler/Tasks/ConfigureForiOS
Watch the web requests and make sure the point is being added with the correct parameters. Hope this helps.
-Noah
//convert longitude and latitude to map point X Y double mercatorX = longitude * 0.017453292519943295 * 6378137.0; double a = latitude * 0.017453292519943295; double mercatorY = 3189068.5 * log((1.0 + sin(a))/(1.0 - sin(a))); AGSPoint *graphicPoint = [AGSPoint pointWithX:mercatorX y:mercatorY spatialReference:[AGSSpatialReference wgs84SpatialReference]];