drawingInfo nil for AGSServiceFeatureTable

702
3
10-08-2020 04:18 PM
JoshuaFriesenhahn
New Contributor II

My ultimate goal is to get at the server prescribed color for a feature. I am attempting to do that by acquiring the AGSSymbol via  AGSServiceFeatureTable->layerInfo->drawingInfo->renderer->symbol. However, for every layer I've tested, drawingInfo is nil (before and after loading the table). 

Some help would be greatly appreciated.

Tags (2)
0 Kudos
3 Replies
Nicholas-Furness
Esri Regular Contributor

Do you have an example layer you could share?

Another approach could be to use the AGSRenderer.symbolForFeature() method. Get the renderer directly off the feature layer, and pass in the feature in question.

0 Kudos
JoshuaFriesenhahn
New Contributor II

So, about 6 hours after my post, it suddenly started working. drawingInfo was no longer nil, and I was able to easily acquire the symbols I needed to. No code change, nothing. It's great that it started working, but I have no idea why it wouldn't work at first nor why it started working eventually, and that concerns me.  This happened both while pointing to ArcGIS Online and also while pointing at an enterprise server of one of our customers. 

Any idea what might have caused this issue? I'm concerned about it possibly happening to a customer, temporary or not.

0 Kudos
Nicholas-Furness
Esri Regular Contributor

Are you sure the layer loaded OK? I would have expected a load error in this case.

I can't explain why ArcGIS and an Enterprise server would have failed at the same time except for some network/firewall issue, possibly exacerbated by caching on the device. Did you test on more than one device, and were you behind a firewall/load balancer at the time that might have blocked traffic or cached a bad response?

If you see it happen again, you should check the loadError property on the AGSServiceFeatureTable, and can use AGSRequestConfiguration.debugLogRequests and debugLogResponses to log network traffic to the console. This should tell you what's going wrong. You can also control the URLSession cache policy with the requestCachePolicy property.

You can either control the global AGSRequestConfiguration, or copy() the global one, modify the copy, and set the copy on the AGSServiceFeatureTable.requestConfiguration property to just control calls to that service. This is true of any class that implements AGSRemoteResource.

0 Kudos