首页 > 其他 > 详细

判断设备容量

时间:2014-12-09 19:42:10      阅读:229      评论:0      收藏:0      [点我收藏+]

- (float)getTotalDiskSpace

{

float totalSpace;

NSError * error;

NSDictionary * infoDic = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[self getHomeDirectory] error: &error];

if (infoDic) {

NSNumber * fileSystemSizeInBytes = [infoDic objectForKey: NSFileSystemSize];

totalSpace = [fileSystemSizeInBytes floatValue]/1024.0f/1024.0f/1024.0f;

return totalSpace;

} else {

NSLog(@"Error Obtaining System Memory Info: Domain = %@, Code = %ld", [error domain], (long)[error code]);

return 0;

}

- (NSString *)getHomeDirectory

{

NSString * homePath = NSHomeDirectory();

return homePath;

}

判断设备容量

原文:http://blog.csdn.net/zh_2608/article/details/41826973

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!