无法获取FileCreationDate? [英] Can't get FileCreationDate?

查看:118
本文介绍了无法获取FileCreationDate?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我创建一个目录,然后下面的代码工作:

In my app, I create a directory, and then the following code works:

NSDictionary *fileAttributes = [fileManager fileAttributesAtPath:trackDirectory traverseLink:YES];
NSDate *fileDate = [fileAttributes objectForKey:NSFileModificationDate];

但是,当我尝试获取NSFileCreationDate时,它不工作。

However, when I try and get the NSFileCreationDate instead, it doesn't work.

我做错了什么?

推荐答案

可以看到,iPhoneOS上没有其他日期。这里是整个 attributesOfItemAtPath:看起来像:

As far as I can see, there is no other date on iPhoneOS. Here is what the whole attributesOfItemAtPath: looks like:

{
    NSFileGroupOwnerAccountID = 20;
    NSFileGroupOwnerAccountName = staff;
    NSFileModificationDate = 2009-12-03 21:34:59 -0800;
    NSFileOwnerAccountID = 501;
    NSFileOwnerAccountName = username;
    NSFilePosixPermissions = 420;
    NSFileReferenceCount = 1;
    NSFileSize = 8703;
    NSFileSystemFileNumber = 14066295;
    NSFileSystemNumber = 234881026;
    NSFileType = NSFileTypeRegular;
}

所以,你的答案是..你试图访问字典键这在iPhoneOS上不存在。

So, your answer is.. you're trying to access a dictionary key that is not present on iPhoneOS.

这篇关于无法获取FileCreationDate?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆