charlie.jacobsen

Crash When Using AGSCalloutTemplate

Discussion created by charlie.jacobsen on Jun 24, 2012
Latest reply on Jun 25, 2012 by njarecha-esristaff
I'm getting a mysterious crash when I try to use the simple AGSCalloutTemplate. As indicated in "Using AGSCalloutTemplate" here, one simply specifies the text template for the title and detail properties, and that's it. But it crashes when I tap on a graphic added in the following way:


    AGSPoint *p = [[AGSPoint alloc] initWithX:-111.0f y:40.0f spatialReference:[[AGSSpatialReference alloc] initWithWKID:4326]];
    
    
    AGSPictureMarkerSymbol *s = [[AGSPictureMarkerSymbol alloc] 
                                 initWithImageNamed:@"symbol_image.png"];
    
    NSMutableDictionary *attr = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
                                 
                                 @"San Diego", @"Title",
                                 @"Population 10,000", @"Detail",
                                 
                                 nil];

    AGSCalloutTemplate *temp = [[AGSCalloutTemplate alloc] init];
    temp.titleTemplate = @"${Title}";
    temp.detailTemplate = @"${Detail}";
    
    AGSGraphic *g = [[AGSGraphic alloc] initWithGeometry:p 
                                                  symbol:s 
                                              attributes:attr 
                                    infoTemplateDelegate:temp];
    
    [self.graphicLayer addGraphic:g];



I don't have anything fancy happening outside of this code; and the problem goes away when I either set the infoTemplateDelegate to nil in the graphic constructor, or use my own info template delegate (implementing the title and detail info provider methods). I have no trouble accessing the attributes dictionary in my delegate methods (when I implement my own delegate, instead of using AGSCalloutTemplate).

Does AGSCalloutTemplate expect the attributes dictionary to have some particular structure?

I can get by and will probably end up just making my own delegate, but I thought I would bring this to everyone's attention in case this is a bug. It looks like it's crashing in the AGSMapView method setupCalloutUIForGraphic:mapPoint:.

Outcomes