// Get indexes of visible layers
AGSMapServiceInfo *dynaServiceInfo = self.dynamicLayer.mapServiceInfo;
AGSMapServiceLayerInfo *dynaLayerInfo;
NSMutableArray *visibleLayers = [NSMutableArray arrayWithCapacity:[dynaServiceInfo.layerInfos count]];
for (int i = 0; i < [dynaServiceInfo.layerInfos count]; i++) {
dynaLayerInfo = [dynaServiceInfo.layerInfos objectAtIndex:i];
if (dynaLayerInfo.visible == YES) {
[visibleLayers addObject:[[NSNumber alloc] initWithInt:i]];
}
}