문제

Is it possible/Is there a file attribute to get the date, when a file was added to the mobile documents folder/icloud?

도움이 되었습니까?

해결책

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;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top