• 获取磁盘空间大小


    RT:

    -(float)getTotalDiskSpaceInBytes {  

        float totalSpace = 0.0f;  

        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];  

            totalSpace = [fileSystemSizeInBytes floatValue];  

        } else {

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

        }  

        return totalSpace;  

  • 相关阅读:
    数组——基础
    程序流程控制——循环结构
    程序流程控制——分支结构
    运算符
    进制
    变 量
    Java中的名称命名规范
    标识符(Identifier)
    保留字(reserved word)
    关键字
  • 原文地址:https://www.cnblogs.com/javawebsoa/p/2458498.html
Copyright © 2020-2023  润新知