When to query AGSGDBFeatureServiceTable?

2279
1
10-28-2015 12:32 PM
KyleDunaway
New Contributor III

After I have set an AGSGDBFeatureServiceTable, and invoked the loadCompletion block, I set the delegate and add the layer to my mapView.

Inside the delegate layerDidLoad method, I receive confirmation the layer did load.

Then I query the AGSGDBFeatureServiceTable for features, and get mixed results.  Sometimes I get all the features, 5 total, and other times I get 0.

The documentation led me to believe that layerDidLoad is what I should be waiting for but it looks like that isn't it.  I can't seem to find what exactly I should be waiting for to query the service.

Any ideas?

Tags (1)
0 Kudos
1 Reply
MengyiGuo
Occasional Contributor

The Query should be executed after layer is loaded. That is to say, LayerDidLoad is the method you are looking for: arcgis-runtime-samples-ios/RootViewController.swift at master · Esri/arcgis-runtime-samples-ios · Gi...

Before that, you want to make sure that you have your layer created with your AGSGDBFeatureServiceTable and added to the map, just like this:

let featureServiceTable = AGSGDBFeatureServiceTable(serviceURL: url, credential: weakSelf.gdbTask.credential, spatialReference: weakSelf.mapView.spatialReference)

let featureTableLayer = AGSFeatureTableLayer(featureTable: featureServiceTable)

featureTableLayer.delegate = weakSelf

weakSelf.mapView.addMapLayer(featureTableLayer)

If it doesn't work for you, would you like to provide your code?