我做错了什么?
NSFileManager *fm = [NSFileManager defaultManager];
NSLog(@"%llu", [[fm attributesOfItemAtPath:@"~/Library/Safari/History.plist" error:NULL] fileSize]);
结果始终为 0。 谁能帮我?提前致谢。
最佳答案
波形符不会自动扩展。
您可以使用stringByStandardizingPath展开它,例如:
[[fm attributesOfItemAtPath:[@"~/Library/Safari/History.plist" stringByStandardizingPath] error:NULL] fileSize]
关于objective-c - 在 Objective-C 中获取文件的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7838725/