IAP hosted content download issues (iOS 14.2)

I'm still seeing various confusing download states in the transaction when trying to download content. I'm mostly seeing issues on iOS 14.2.

A quite common error seems to be the download being reported as finished and there is a referenced cache folder in Library/Caches/StoreKit.

However, this folder appears to be empty and there is no "Contents" sub-folder as expected.

What seems to happen is that the download transitions from waiting (progress zero) to finished (progress 1.0) straight after the download has been started. This error condition persists until a power-cycle of the device which seems to clear the error, allowing the download to proceed successfuly.

Also, can someone confirm the naming convention of these cache files changed significantly in iOS 14? In 13.7 for example, the download location and naming convention appear to be different.

I'm also still seeing occasional instances where the state is waiting, but the download progress goes from zero to 1.0 and the content is actually downloaded.

In this latter error scenario, it means I have to have a workaround to essentially ignore this documentation:

Use the downloadState property to determine whether the download has completed. Don’t use the progress or timeRemaining property of the download object to check its status; these properties are for updating your UI.


I've seen various confused states for downloads, but my impression is that they don't affect end users, i.e. they only affect development devices. Do you believe your end users are affected by these issues?

What I find is that I can get into a state where transactions have not been finished for some reason, and when the app restarts Store Kit sends me updatedTransactions: with state Purchased or Restored. I then call startDownloads, but I never get an updatedDownloads with state Finished (possibly no updatedDownloads at all?). Since I wait for the download to finish before finishing the transaction, the same thing happens when the app next starts. But as I say, I've not seen any evidence that this affects end users.

I will have a look at the download progress and see if it is 1.0 in this case. (My downloads are very small.) So do you find that the download's contentURL is valid even though the state is not finished?

I have also worried about whether I should be deleting the files referred to by the download's contentURL after I have processed them. What do you do? I worry that Store Kit may not know that I have deleted them if I restoreTransactions and do the download again, and it may think it has a cached copy of the download to give me, but it doesn't because I deleted it. I asked Developer Technical Support about this last year but my question didn't reach anyone who understood it.

iOS or macOS BTW? The above is all on iOS.
IAP hosted content download issues (iOS 14.2)
 
 
Q