Вы действительно получаете NSDate
не строку:
NSString *filePathName = [directory stringByAppendingPathComponent:fileName];
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filePathName error:&error];
// No attributes then jst skip the file
if (!attributes || error) {
NSLog(@"Error getting attributes for: %@\nWith error: %@", filePathName, error);
retun;
}
NSDate *modifiedDate = [attributes objectForKey:NSFileModificationDate];
С NSDateFormatter
вы получаете строку с этой даты:
NSDateFormatter *formatter = [[NSDateFormatter alloc]
[formatter setDateFormat:@"yyyy-MM-dd"];
NSString *datestring = [formatter stringFromDate:modifiedDate];
[formatter release], formatter = nil;