iphone - iOS:Arcgis:featureLayer.types 返回 Null

标签 iphone xcode ios arcgis

我正在尝试在图层中添加要素类型 (featureLayer.types),以便用户可以选择一个。 ESRI 的示例“FeatureLayerEditingSample”执行此操作,但 View Controller 是通过那里的先前 View Controller 初始化的。 http://www.arcgis.com/home/item.html?id=2ddb261648074b9aabb22240b6975918

当我尝试遍历我的 featureLayer 的类型时,它没有返回任何东西并且 [self.featureLayer.types count] 返回 0。

我想我缺少一些需要设置到 featureLayer 的基本属性。感谢这方面的任何帮助。

我的 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

非常感谢!

最佳答案

您需要先将要素添加到 mapView。在添加之前,它不会从 MapService 中检索信息。您应该指定一个 Layer Delegate,以便您可以监听要成功加载的 Layer。

关于iphone - iOS:Arcgis:featureLayer.types 返回 Null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5719035/

相关文章:

ios - 不同的定位取决于目标

ios - 如何在iOS中实现滚动然后修复项?

iphone - 从 NSDateComponents 获取 MAX_INT

iphone - iPhone 上未收到服务器响应

iphone - 在 Interface Builder 中,当一组矩形项目位于背景项目之上时,如何选择它们?

ios - 可以使用Macro识别iOS设备吗?

iOS webview 连接错误处理

ios - 驻留内存与事件字节

ios - 自定义CollectionViewCell

ios - JSONModel:填充泛型类型的 NSArray