wherewhy

Filter fields using AGSPopupInfo fieldsinfos throws error

Discussion created by wherewhy on Aug 12, 2011
Latest reply on Sep 9, 2011 by hermss
Does anyone know how to properly filter the list of fields to display in the PopupInfo?

Here is the code that sends all fields in the Feature Class off to the popupViewController


-(void)mapView:(AGSMapView *)mapView didClickCalloutAccessoryButtonForGraphic:(AGSGraphic *)graphic{
   

    self.popupInfo = [AGSPopupInfo popupInfoForGraphic: graphic];
   
    self.popupInfo.allowEditGeometry = NO;
   
    //Show popup for the graphic because the user tapped on the callout accessory button
    self.popupVC = [[[AGSPopupsContainerViewController alloc] initWithPopupInfo:_popupInfo graphic:graphic usingNavigationControllerStack:NO] autorelease];
    self.popupVC.delegate = self;
    self.popupVC.modalTransitionStyle =  UIModalTransitionStyleFlipHorizontal;
    //If iPad, use a modal presentation style
    if([[UIDevice currentDevice] isIPad])
        self.popupVC.modalPresentationStyle = UIModalPresentationFormSheet;

    [self presentModalViewController:self.popupVC animated:YES];
    [self.popupVC startEditingCurrentPopup];

}

I want to only show Two fields, instead of all of the fields in the Feature Service Feature Class that "graphic" represents.


The class reference is here: (Search for AGSPopupInfo)
http://help.arcgis.com/en/arcgismobile/10.0/apis/iOS/2.0/reference/index.html

It says to set the description to nil and then send it an NSArray of fields.
I try that, but get an error (see below for error).


-(void)mapView:(AGSMapView *)mapView didClickCalloutAccessoryButtonForGraphic:(AGSGraphic *)graphic{
   

    self.popupInfo = [AGSPopupInfo popupInfoForGraphic: graphic];
   
    self.popupInfo.allowEditGeometry = NO;


    NSMutableArray *items = [[NSMutableArray alloc] init];
   
    [items addObject:@"OBJECTID"];
    [items addObject:@"STATUS"];
   
    self.popupInfo.description = nil;
   
   self.popupInfo.fieldInfos = items;
   
    [items release];


   
    //Show popup for the graphic because the user tapped on the callout accessory button
    self.popupVC = [[[AGSPopupsContainerViewController alloc] initWithPopupInfo:_popupInfo graphic:graphic usingNavigationControllerStack:NO] autorelease];
    self.popupVC.delegate = self;
    self.popupVC.modalTransitionStyle =  UIModalTransitionStyleFlipHorizontal;
    //If iPad, use a modal presentation style
    if([[UIDevice currentDevice] isIPad])
        self.popupVC.modalPresentationStyle = UIModalPresentationFormSheet;

    [self presentModalViewController:self.popupVC animated:YES];
    [self.popupVC startEditingCurrentPopup];
}

When I run this, I get the following error:

2011-08-12 11:52:04.891 FeatureLayerEditingSample[16177:207] -[NSCFString isVisible]: unrecognized selector sent to instance 0x60f5c4
2011-08-12 11:52:04.940 FeatureLayerEditingSample[16177:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString isVisible]: unrecognized selector sent to instance 0x60f5c4'


Any ideas?

Outcomes