In the Version 100 Runtime, we take a slightly different approach for efficiency's sake.
Features will by default only include the minimal set of fields required for rendering and editing. When you are making a selection, you are working with those features, so that's why you're seeing the smaller set of fields.
If you need all the fields for your selected features, you should actually perform a query on your AGSServiceFeatureTable
and select the features based off that.
Something like this:
let table = selectableLayer.featureTable as? AGSServiceFeatureTable
table?.queryFeatures(with: query, queryFeatureFields: .loadAll) { (result, error) in
guard error == nil else {
print("Error selecting features: \(error!.localizedDescription)")
return
}
guard let features = result?.featureEnumerator().allObjects else {
return
}
selectableLayer.select(features)
for feature in features {
let keys = feature.attributes.allKeys
print(keys)
}
}
What's odd is that you say you're seeing a different number of fields returned on Android than on iOS. Are you sure the Android app is displaying the same layer with the same renderer?
One other point: You might be better off using the Esri Community (GeoNet). The ArcGIS Runtime SDK for iOS Forum can be found here. Do post a question there if you are seeing different numbers of fields on iOS and Android with the same layer and renderer.
Hope this helps!
P.S. There are two related things you might want to know.
AGSArcGISFeature
instances are now Loadable. So if you have an individual feature and you want to get all the fields for it from the source service, you can call load(completion:)
on it. Or you could pass an [AGSArcGISFeature]
array to the ASGLoadObjects()
helper function. However, that function will make a separate network request for each feature so if your array isn't small, that could lead to a bad user experience.
- You can set your
AGSServiceFeatureTable.featureRequestMode
to .manualCache
. You then need to call populateFromServiceWithParameters()
to load the precise data that you need locally (and as you pan and zoom the map, you will need to manually manage this cache). See here for more details.