简体   繁体   English

iOS:Arcgis:featureLayer.types返回Null

[英]iOS: Arcgis: featureLayer.types returns Null

I am trying to feature types (featureLayer.types) within a layer so that the user can select one. 我正在尝试在图层中显示类型(featureLayer.types),以便用户可以选择一个。 ESRI's Sample "FeatureLayerEditingSample" does this but the view controller is initialized through the previous View Controller there. ESRI的示例“FeatureLayerEditingSample”执行此操作,但视图控制器通过之前的View Controller初始化。 http://www.arcgis.com/home/item.html?id=2ddb261648074b9aabb22240b6975918 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.featureLayer.types count] returns 0. 当我尝试遍历我的featureLayer类型时,它不返回任何内容,[self.featureLayer.types count]返回0。

I think I'm missing some basic properties that need to set to the featureLayer. 我想我缺少一些需要设置为featureLayer的基本属性。 Appreciate any help in this. 感谢任何帮助。

My viewDidLoad method goes like this: 我的viewDidLoad方法是这样的:

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. 您需要先将该功能添加到mapView。 It won't retrieve the information from the MapService until it's been added. 在添加之前,它不会从MapService检索信息。 You should specify a Layer Delegate so that you can listen for the Layer to be loaded sucessfully. 您应该指定一个图层委托,以便您可以成功监听要加载的图层。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM