Download progress when downloading a AGSPortalItem with fetchData(completion:)

1549
2
12-25-2016 07:23 AM
LinnartBaeker
New Contributor II

Is there a way to get continues download progress updates (aka bytesLoaded/bytesTotal) when loading a PortalItem? I would like to display a download progress bar to the user.

Best,

Linnart

0 Kudos
2 Replies
YueWu1
by Esri Regular Contributor
Esri Regular Contributor

Hi Linnart,

Based on my knowledge, our current SDK doesn't provide that method to directly check about download percentage of the portalItem. 

The only thing that I can think of utilize from our SDK is this method: AGSPortalItem: fetchDataWithCompletion 

However, this completion handler is design for checking if the data finished. I am not positive that if there is anyway that you can check the NSData size to kind of tracking the download process.

Based on my understand, you probably need to add your logic to fulfill this function, here I found a related thread talks about how to create a download progress in swift: https://grokswift.com/download-progress/ 

Hope this can help.

0 Kudos
LinnartBaeker
New Contributor II

Thanks for the reply. I think that is not possible. I only ever get access to the Data object when the completion callback is called. 

In the AGSLoadable Protocol there is a property called

    public var loadStatus: AGSLoadStatus { get }

which is stated to be KVO compliant. It should be easy to add another kvo compliant property that has the download progress. How can I file an enhancement request to the API? Having a download of possible hundreds of MB of data triggered by a user without any indication how long the download will take is out of the question.