1

I am trying to code downloading of files...And i want to implement a checker as to the remaining device storage.. i am trying to implement the ALDisk from

https://github.com/andrealufino/ALSystemUtilities/blob/develop/ALSystemUtilities/ALSystemUtilities/ALDisk/ALDisk.m

which i was able to get from

How to detect total available/free disk space on the iPhone/iPad device?

When i check iOS device storage through General>About and compare it with the value being returned by the ALDisk

... it results to a 200 MB difference.. the 200 MB is NOT exactly 200 MB perse... just a rounded up/down value...

A. Is there really an allowance? B. coz i tried to search for it but i cant find a source. kindly post the link here if u find one C. Is there anyway i could get that allowance per device? D. or is it 200 MB fixed for all devices of iOS

thanks

Community
  • 1
  • 1
  • 2
    Have you tried dividing by 1000 instead of 1024? Actually you should use [NSByteCountFormatter](https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSByteCountFormatter_Class/index.html) – HAS Jan 20 '15 at 11:54
  • thnx HAS I tried your suggestion.. using 1000 instead of 1024... the result was the settings in iPhone displays 70MB but in log in xcode using NSByteCountFormatter it was 264.4MB.. it didnt work – user3346155 Jan 21 '15 at 01:05
  • I've just tried it myself on a 64 GB iPhone 6 Plus and the difference is 800 Megs using NSByteFormatter... I don't know why they show in Settings 800 MB less (7.9 vs 8.65 GB). – HAS Jan 21 '15 at 04:46
  • I've tried to research about this and i was able to find MANY cases like this.. most of them reporting around 200 MB .. and i was not able to find a solution – user3346155 Jan 21 '15 at 05:55
  • This is really weird. I can only think of it this way: what we use are developer tools. We are supposed to know what we know (don't fill up all the available space). What you see in Settings is ment to be read by a user (who doesn't know that) so iOS tells him (and maybe manages its disk space that way) that there is less space than there actually is (so that there is enough space to run the system in a stable way (caching, virtual memory, etc.). This is the only explanation I can think of. – HAS Jan 21 '15 at 06:46
  • Yeah.. thats what i thought of as well.. however.. my colleagues suggested that if there is a way to check via code the alloted allowance per device... so that we don't have to hard code the 200 MB.. and as you stated.. yours displayed 800MB difference – user3346155 Jan 21 '15 at 07:01
  • My fault! I tested it using NSByteCountFormatter ... That uses 1000 instead of 1024, if I use 1024 I also get around 200 MB! Sorry for that! So maybe you can hardcode it ... Of course it is subject to change ... – HAS Jan 21 '15 at 07:10
  • yeah.. but thats what we are trying to avoid .. to hardcode it.. if there is another way to check the alloted space in that specific device running our app then we would prefer that – user3346155 Jan 21 '15 at 07:12
  • And that is really a good way to do it! (I would never hardcode anything, remember what happened to apps that hardcoded the status bar height or keyboard height? ... That is only a last resort (and in the mentioned cases avoidable, in this case it seems there is no (obvious) clean solution. I'd recommend asking that question on the Apple dev forums, chances of getting an (maybe not official but sophisticated) answer from an Apple internal are higher. – HAS Jan 21 '15 at 07:21
  • thanks for all your help @HAS – user3346155 Jan 21 '15 at 08:26
  • You're most welcome! – HAS Jan 21 '15 at 08:27

0 Answers0