I have a MacOS app in the store that tries to address the issues related by starkadhr, and some potential customer (probably some Unix guy) asked whether the app could change the creation date/year of, again, scanned photos before 1/1/1970. No. With Eskimo's reservations about changing creation dates noted, I changed the creation date my old-fashioned way in ObjC (I don't do Swift - I'm passed my prime since I had one of the first 500 apps in the app store).
NSDictionary *fileDict = [NSDictionary dictionaryWithObjectsAndKeys:createDate, NSFileCreationDate, modDate, NSFileModificationDate, nil];
[[NSFileManager defaultManager] setAttributes:fileDict ofItemAtPath:[self.urlForCurrentImage path] error:nil];
I'm wondering if this ObjC code below will work with earlier dates than 1970 or is this still using setFile/old Unix code somehow?
- (BOOL)setUnixSafeFileCreationDate:(NSDate *)date fileURL:(NSURL *)url {
NSError *error = nil;
BOOL success = [url setResourceValue:date
forKey: NSURLCreationDateKey
error:&error];
if (!success) {
NSLog(@"NSURLCreationDateKey error: %@", error);
return false;
} else {
return true;
}
}