我做了这个函数,它返回文档目录中文件的大小,它可以工作,但我收到警告,我希望修复,函数:
-(unsigned long long int)getFileSize:(NSString*)path
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *getFilePath = [documentsDirectory stringByAppendingPathComponent:path];
NSDictionary *fileDictionary = [[NSFileManager defaultManager] fileAttributesAtPath:getFilePath traverseLink:YES]; //*Warning
unsigned long long int fileSize = 0;
fileSize = [fileDictionary fileSize];
return fileSize;
}
*警告是'fileAttributesAtPath:traverseLink: is deprecated first deprecated in ios 2.0'。这是什么意思,我该如何解决?