2

Apple's documentation talks about handling the situation where a user runs out of disk space while downloading your In-App-Purchase content

Ensure that your app handles errors gracefully. For example, if the device runs out of disk space during a download, give the user the option to discard the partial download or to resume the download later when space becomes available.

https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/DeliverProduct.html

But give no examples or clue at the best practise.

What is the best way to firstly recognise that they have run out of disk space during a download and secondly how to resume the download later when space becomes available?

Daij-Djan
  • 47,307
  • 15
  • 99
  • 129
daihovey
  • 3,653
  • 13
  • 62
  • 103
  • You should do what installation wizards do on desktops: they won't do anything if there isn't enough space beforehand. So it would be cool if you check if they have enough space before starting a download. – Voldemort Jul 12 '14 at 05:21
  • @JustKidding how do you do that? – daihovey Jul 12 '14 at 05:28
  • check out http://stackoverflow.com/questions/5712527/how-to-detect-total-available-free-disk-space-on-the-iphone-ipad-device – danh Jul 12 '14 at 05:46
  • @danh Thanks for the link. How would this be implemented? Do I check the diskspace every time paymentQueue:updatedDownloads: is called (and state == SKDownloadStateActive) and work out if its going to end up with zero room left? Or should I pull the plug earlier than zero room left? Are there any guidelines around this? – daihovey Jul 14 '14 at 00:43

1 Answers1

0

A good UI tells the user about the state of the app. While the app is downloading, it's incumbent on the app to let the user know that's happening. The simplest error check would just check for failure of any sort and report the most specific error possible.

The next more proactive idea would be to check for failures as above, but add the check for disk space to give a more specific error.

If you know a lot about the download size, like a minimum size, then you could check space even more proactively before the download begins. The situation to avoid (if you have foreknowledge) is a long, large, partial download followed by a disk space error that was predictable earlier.

danh
  • 55,236
  • 10
  • 89
  • 124