Reputation: 176
Is it possible/Is there a file attribute to get the date, when a file was added to the mobile documents folder/icloud?
Upvotes: 0
Views: 273
Reputation: 176
I've found the answer in another question here at stackoverflow:
Where does the Finder obtain the "date added" of an item in a folder?
The date-added attribute is in the Spotlight metadata:
NSDate *dateAdded(NSURL *url)
{
NSDate *rslt = nil;
MDItemRef inspectedRef = nil;
inspectedRef = MDItemCreateWithURL(kCFAllocatorDefault, (CFURLRef)url);
if (inspectedRef){
CFTypeRef cfRslt = MDItemCopyAttribute(inspectedRef, (CFStringRef)@"kMDItemDateAdded");
if (cfRslt) {
rslt = (NSDate *)cfRslt;
}
}
return rslt;
}
Upvotes: 1