Download Asset Abandon issue
hi,
I found a bug when downloading asset and the server is offline , the status of issue is downloading and progress bar appears, but it will never finish.
also after opening the app again, it still downloading , and I can't cancel it , also I can't download other issues even if I closed the app and run it again.
this is the console message ,
NewsstandKit: cleaning up abandoned asset downloads: ( "<NKAssetDownload: 0xce31b70> -> {identifier: 'CAE64516-D680-4863-BA3E-E0E8A0F26FF1/E6E2E96E-6E64-4977-846C-F617C43537FA' request: <NSURLRequest http://localhost:8888/Magazines/ArabicSupport/book.hpub> downloading: NO}"
While this is related to #582, it's probably worth to keep separate because it's not much about the connection status but about downloads. It might be that it will get solved at the same time, but there's a change it will not.
Thanks. :)
I noticed a similar thing... I was able to create the issue while just trying to start the download when the iPad was offline. However when reconnecting to the Internet the download continued until it finished. I still think you are right though, there should be a way to cancel the download once it has started.
Actually shouldn't this just fail? If the server is offline it should reach the didFailWithError... Is it just an issue with the progressbar still showing or is it actively trying to do something?
I'll leave @Simbul answering, but as far as we tested it seems that that error isn't triggered. :/
I am actually using the Reachability code in my shelf version to check that it's able to connect prior to kicking off the download, so I don't know about this case. It's weird that the error isn't triggered though.
I just tried it with a bad url for the hpub, and the error did get triggered... Was anyone able to recreate this issue?
A bad URL works, but despite a lot of testing I wasn't able to get a didFailWithError callback when there's no network (easily testable in Airplane Mode).
Even setting the timeout explicitly when instancing the NSURLRequest doesn't have any effect.
The next thing I want to try is a pre-flight check using canHandleRequest from the NSURLConnection, but that still wouldn't cover every possible case (e.g. connection dropping in the middle of a download).
I had to go quite a long way deep down the rabbit hole, but I think I managed to figure this out.
First of all: commit ce30a1a adds support for resuming Newsstand downloads when reopening the app. There was indeed a bug in the code which could lead to an issue getting stuck in the "downloading" status.
As for the connection timeout, turns out that's expected behaviour for Newsstand. Basically, a Newsstand download never times out: it will simply be retried periodically until the device comes back online.
This means the issue is pretty much fixed now, but I'll keep it open as we are looking into ways of making this less confusing from a UI perspective.
Better UI introduced in 48fa405.