ios 获取系统容量
来源:互联网 发布:淘宝国际 编辑:程序博客网 时间:2024/06/11 20:11
//获取系统容量及可使用容量
+(float)getFreeDiskspace {
float totalSpace;
float totalFreeSpace;
NSError *error = nil;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
if (dictionary) {
NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];
NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
totalSpace = [fileSystemSizeInBytes floatValue];
totalFreeSpace = [freeFileSystemSizeInBytes floatValue];
NSLog(@"总容量 %f GB 可用容量 %f GB ", ((totalSpace/1024.0f)/1024.0f/1024.0f), ((totalFreeSpace/1024.0f)/1024.0f)/1024.0f);
} else {
}
return totalFreeSpace;
}
+(float)getFreeDiskspace {
float totalSpace;
float totalFreeSpace;
NSError *error = nil;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
if (dictionary) {
NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];
NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
totalSpace = [fileSystemSizeInBytes floatValue];
totalFreeSpace = [freeFileSystemSizeInBytes floatValue];
NSLog(@"总容量 %f GB 可用容量 %f GB ", ((totalSpace/1024.0f)/1024.0f/1024.0f), ((totalFreeSpace/1024.0f)/1024.0f)/1024.0f);
} else {
}
return totalFreeSpace;
}
- ios 获取系统容量
- iOS获取设备容量
- 获取系统容量及可使用容量
- iOS获取设备电量、内存、容量
- iOS开发 - 如何获取设备的总容量和可用容量
- iOS开发 - 获取磁盘容量及可用空间
- 获取系统信息,如开机时间,ram容量,等信息
- ios获取系统时间
- 获取iOS系统版本号
- ios 获取系统版本号
- IOS 获取系统字体
- IOS获取系统信息
- 获取系统时间ios
- ios 获取系统照片
- IOS 获取系统版本号
- iOS 获取系统相册
- iOS获取系统语言
- IOS获取系统图片
- Android调用百度api 获取经纬度以及地图 demo你怎么可以那么坑我????
- 【小波变换】STL版 一维离散小波变换(DWT)库,完全按matlab的wavelet toolbox 的API实现的
- iOS文件操作 NSFileManager
- 异步SRAM的信号
- Java读取和修改ini配置文件
- ios 获取系统容量
- 新浪微博搜索其实就是人肉索引擎!
- 模板元编程练习
- Git push 出错以及server端没有显示push后的文件的解决方法
- win7下vc6.0打开文件未响应的解决方法
- eclipse插件egit安装使用
- git错误解决
- 动态链接库、HOOK及windows API编程需要注意的地方
- (转)Facebook杯2013年编程挑战赛——预选赛题目及答案