fileCreationDate действительно часть словаря. Вот метод, который получает переданный URI файла и захватывает некоторые атрибуты из файла:
- (NSDictionary *) attributesForFile:(NSURL *)anURI {
// note: singleton is not thread-safe
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *aPath = [anURI path];
if (![fileManager fileExistsAtPath:aPath]) return nil;
NSError *attributesRetrievalError = nil;
NSDictionary *attributes = [fileManager attributesOfItemAtPath:aPath
error:&attributesRetrievalError];
if (!attributes) {
NSLog(@"Error for file at %@: %@", aPath, attributesRetrievalError);
return nil;
}
NSMutableDictionary *returnedDictionary =
[NSMutableDictionary dictionaryWithObjectsAndKeys:
[attributes fileType], @"fileType",
[attributes fileModificationDate], @"fileModificationDate",
[attributes fileCreationDate], @"fileCreationDate",
[NSNumber numberWithUnsignedLongLong:[attributes fileSize]], @"fileSize",
nil];
return returnedDictionary;
}
Эй, Грег, прошло 2 года, как «принять приём? : D – memmons
Честно говоря, я не знаю, исправил ли ваше решение мою проблему! (Я не могу больше помнить.) Проблема, с которой я столкнулась, - это не код для доступа к дате создания; это то, что дата создания просто не возвращалась как один из атрибутов файла. –
LOL, мужик, ты крутой! – memmons