iOS: Arcgis: featureLayer.types returns Null
I am trying to feature types (featureLayer.types) within a layer so that the user can select one. ESRI's Sample "FeatureLayerEditingSample" does this but the view controller is initialized through the previous View Controller there. http://www.arcgis.com/home/item.html?id=2ddb261648074b9aabb22240b6975918
When I try to loop through the types of my featureLayer, it doesn't return anything and [self.featureLaye开发者_StackOverflowr.types count] returns 0.
I think I'm missing some basic properties that need to set to the featureLayer. Appreciate any help in this.
My viewDidLoad method goes like this:
self.featureLayer = [AGSFeatureLayer featureServiceLayerWithURL:[NSURL URLWithString:@"http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0"] mode:AGSFeatureLayerModeOnDemand];
NSArray* types1 = self.featureLayer2.types;
AGSFeatureType* selectedType1 = [types1 objectAtIndex:2];
NSLog(@"count of types is %d \n", [selectedType1.types count]); //returns 0
Thanks a ton!
You need to add the feature to the mapView first. It won't retrieve the information from the MapService until it's been added. You should specify a Layer Delegate so that you can listen for the Layer to be loaded sucessfully.
精彩评论