瀏覽代碼

磁盘剩余空间计算

harry 3 年之前
父節點
當前提交
6dfc541cd0
共有 2 個文件被更改,包括 6 次插入2 次删除
  1. 2 0
      BFCommonKit/Classes/BFUtility/PQBridgeObject.h
  2. 4 2
      BFCommonKit/Classes/BFUtility/PQBridgeObject.m

+ 2 - 0
BFCommonKit/Classes/BFUtility/PQBridgeObject.h

@@ -18,6 +18,8 @@ NS_ASSUME_NONNULL_BEGIN
 + (long long) getInterfaceBytes;
 + (NSString *)formatNetWork:(long long int)rate;
 
+// 获取磁盘空间大小 单位为Mb
++ (CGFloat)getPhoneDiskFreeSize;
 
 + (NSString *)base64Md5ForFilePath:(NSString *)filePath;
 @end

+ 4 - 2
BFCommonKit/Classes/BFUtility/PQBridgeObject.m

@@ -9,6 +9,7 @@
 #import "PQBridgeObject.h"
 #import "CommonCrypto/CommonDigest.h"
 #import "CommonCrypto/CommonHMAC.h"
+
 int32_t const CHUNK_SIZE = 8 * 1024;
 
 #define CC_MD5_DIGEST_LENGTH    16          /* digest length in bytes */
@@ -100,7 +101,7 @@ int32_t const CHUNK_SIZE = 8 * 1024;
 
 
 // 手机剩余空间
-- (CGFloat)getPhoneDiskFreeSize {
++ (CGFloat)getPhoneDiskFreeSize {
 
     uint64_t totalSpace = 0;
 
@@ -124,7 +125,7 @@ int32_t const CHUNK_SIZE = 8 * 1024;
 
         totalFreeSpace = [freeFileSystemSizeInBytes unsignedLongLongValue];
 
-        s = totalFreeSpace/ (1024.0 * 1024.0);
+        s = totalFreeSpace / (1024.0 * 1024.0);
 
     }
 
@@ -132,4 +133,5 @@ int32_t const CHUNK_SIZE = 8 * 1024;
 
 }
 
+
 @end