"Last Used" metadata (kMDItemLastUsedDate) is not update on some files when opened in Finder

Anyone has any idea why for some files, when double-clicked in Finder, Spotlight will set kMDItemLastUsedDate to the correct value and for some other files, even in the same folder and opened using the same application (such as preview) it won’t. It can be verified by setting the "All My Files” view in Finder to be sorted by “Date Last Opened”. Add the column, if needed.


I ask about Finder but in my application I use an NSMetadataQuery to collect the same information and my code detects the same files as Finder.


Jacob.

Replies

So I noticed something about this, and it's disturbing because it's kinda out of control. Here's what I've found:


So apparently the com.apple.quarantine xattribute is set for files created with Sandboxed applications and downloaded from Internet, which we know. Removing the attribute solves the problem, where opening the file in Finder will actually set its last opened metadata. But why? It also seems that _some_ quarantine values still allow the metadata to be set.


Anybody know what the actual data in the attribute means?


For example, if the first 4 digits are something like 0041 or 0042, the last opened date will update. If it's something else like 0001, it won't.

I noticed this as well, and it's a bit strange. Did you contact anyone at Apple about this?