我试图在我的应用程序中包含一个方法,如determines the size of a file如file.txt,file.app,file.png等。我对如何做到这一点有一般的想法,试过以下,但我的应用程序,因为在年底的NSLog功能的崩溃:Objective-C,以编程方式确定文件大小
NSString *yourPath = @"path/to/file";
NSFileManager *man = [[NSFileManager alloc] init];
NSDictionary *attrs = [man attributesOfItemAtPath: yourPath error: NULL];
UInt32 result = [attrs fileSize];
NSLog(@"Size: @%", result);
如果您发布了“某些原因”,我们实际上可以提供帮助。 – 2012-08-31 18:10:02
是的,有什么错误? *查看*> *调试区*> *激活控制台* – woz
您可以发布您的答案并将其标记为已回答吗? – woz