我希望检索有关的信息,
我确实有磁盘详细信息,例如可用磁盘空间和已用磁盘空间,但我找不到有关读写的信息。 如何在iOS中获取信息?
- (uint64_t)freeDiskspace
{
uint64_t totalFreeSpace = 0;
NSError *error = nil;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [paths lastObject];//[self applicationDocumentsDirectory];
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:path error: &error];
if (dictionary) {
NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
totalFreeSpace = [freeFileSystemSizeInBytes unsignedLongLongValue];
} else {
//NSLog(@"Error Obtaining System Memory Info: Domain = %@, Code = %@", [error domain], [error code]);
}
return totalFreeSpace;
}