Select to view content in your preferred language

Exception using AGSCalloutTemplate when a numeric field is used in the template str

1563
2
04-30-2010 11:30 AM
ChanceYohman
Emerging Contributor
After clicking a feature for a callout, the program yields this exception:

2010-04-30 15:01:27.838 GraphicsDemo[7772:207] countyTemplate's textTemplate: (null)
2010-04-30 15:01:27.838 GraphicsDemo[7772:207] countyTemplate's textTemplate: ${NAME}
2010-04-30 15:01:27.840 GraphicsDemo[7772:207] countyTemplate's detailTemplate: (null)
2010-04-30 15:01:27.841 GraphicsDemo[7772:207] countyTemplate's detailTemplate: '90: ${POP1990}, '99: ${POP1999}
2010-04-30 15:01:31.494 GraphicsDemo[7772:207] *** -[NSDecimalNumber length]: unrecognized selector sent to instance 0x3bb99f0
2010-04-30 15:01:31.495 GraphicsDemo[7772:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSDecimalNumber length]: unrecognized selector sent to instance 0x3bb99f0'
2010-04-30 15:01:31.495 GraphicsDemo[7772:207] Stack: (
    31122523,
    2507121929,
    31504443,
    31073910,
    30926530,
    30652085,
    31049491,
    80337,
    43803,
    856506,
    30907072,
    30903368,
    39212941,
    39213138,
    3346435,
    11480,
    11334
)

The code in question is on lines 244-255 of GraphicsDemoViewController.m
AGSCalloutTemplate *countyTemplate = [[AGSCalloutTemplate alloc] init];
NSLog(@"countyTemplate's textTemplate: %@", [countyTemplate textTemplate]);
[countyTemplate setTextTemplate:@"${NAME}"];
NSLog(@"countyTemplate's textTemplate: %@", [countyTemplate textTemplate]);
NSLog(@"countyTemplate's detailTemplate: %@", [countyTemplate detailTemplate]);
[countyTemplate setDetailTemplate:@"'90: ${POP1990}, '99: ${POP1999}"]; //This is the offending line.
NSLog(@"countyTemplate's detailTemplate: %@", [countyTemplate detailTemplate]);


To see that the problem is the inclusion of a numeric field in the template string, either comment out the offending line or replace the numeric fields with string fields, e.g. ${NAME}.

Is this a bug or am I doing something wrong?

Note: Please replace the GraphicsDemoViewController.m with the attached file (after changing the suffix from .txt to .m). I tried attaching the zip file, but it won't let upload it! It's under the maximum size!!
0 Kudos
2 Replies
DiveshGoyal
Esri Regular Contributor
Unfortunately, you've run into a bug. 😞

Thanks for reporting it. We'll have it straightened out.

_
Divesh
0 Kudos
ChanceYohman
Emerging Contributor
You're welcome. The user-ESRI connection is what make this whole thing work. I appreciate you guys tackling it. Have a nice day.
0 Kudos