|
@@ -98,4 +98,38 @@ int32_t const CHUNK_SIZE = 8 * 1024;
|
|
return [NSData dataWithBytes:(const void *)digestResult length:CC_MD5_DIGEST_LENGTH * sizeof(unsigned char)];
|
|
return [NSData dataWithBytes:(const void *)digestResult length:CC_MD5_DIGEST_LENGTH * sizeof(unsigned char)];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+// 手机剩余空间
|
|
|
|
+- (CGFloat)getPhoneDiskFreeSize {
|
|
|
|
+
|
|
|
|
+ uint64_t totalSpace = 0;
|
|
|
|
+
|
|
|
|
+ uint64_t totalFreeSpace = 0;
|
|
|
|
+
|
|
|
|
+ NSError *error = nil;
|
|
|
|
+
|
|
|
|
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
|
|
|
+
|
|
|
|
+ NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
|
|
|
|
+
|
|
|
|
+ CGFloat s = 0;
|
|
|
|
+
|
|
|
|
+ if (dictionary.count) {
|
|
|
|
+
|
|
|
|
+ NSNumber *fileSystemSizeInBytes = dictionary[NSFileSystemSize];
|
|
|
|
+
|
|
|
|
+ NSNumber *freeFileSystemSizeInBytes = dictionary[NSFileSystemFreeSize];
|
|
|
|
+
|
|
|
|
+ totalSpace = [fileSystemSizeInBytes unsignedLongLongValue];
|
|
|
|
+
|
|
|
|
+ totalFreeSpace = [freeFileSystemSizeInBytes unsignedLongLongValue];
|
|
|
|
+
|
|
|
|
+ s = totalFreeSpace/ (1024.0 * 1024.0);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return s;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
@end
|
|
@end
|