iOS: How do you find the creation date of a file?

This code actually returns the good creation date to me:

NSFileManager* fm = [NSFileManager defaultManager];
NSDictionary* attrs = [fm attributesOfItemAtPath:path error:nil];

if (attrs != nil) {
    NSDate *date = (NSDate*)[attrs objectForKey: NSFileCreationDate];
    NSLog(@"Date Created: %@", [date description]);
} 
else {
    NSLog(@"Not found");
}

Are you creating the file inside the App? Maybe that’s where the problem is.

Leave a Comment