开发者

Disk space for downloaded files in ios app

My app downloads files. How much space I can use for downloaded files? App size开发者_开发百科 is 3-4 mbytes. I save files to documents folder.


There is no capacity limit except the available storage (except for the fact that the app may see a bit less storage then what is actually available on the device - some may be saved for the OS).

To get the free storage available on the device (as your app is concerned):

NSString* docsDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath:docsDir error:NULL];
unsigned long long freeSpaceInBytes = [[fileAttributes objectForKey:NSFileSystemFreeSize] unsignedLongLongValue];
NSLog(@"Memory Capacity of %llu MiB.", ((freeSpaceInBytes/1024ll)/1024ll));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜