【问题标题】:Inserting attributesOfItemAtPath into NSFileManager将 attributesOfItemAtPath 插入 NSFileManager
【发布时间】:2014-08-17 21:24:07
【问题描述】:

NSDictionary * properties = [[NSFileManager defaultManager] attributesOfItemAtPath:myString error:nil];

我需要它来使用 NSURL 而不是 myString。

我还是个新手。

【问题讨论】:

    标签: objective-c nsurl nsfilemanager


    【解决方案1】:
    NSURL *myURL; // assume this is filled with a file:// URL
    NSDictionary * properties = [[NSFileManager defaultManager] attributesOfItemAtPath:[myURL path] error:nil];
    
    // Alternatively for example Creation Date 
    NSDate *creationDate = nil;
    BOOL success = [myURL getResourceValue:&creationDate forKey:NSURLCreationDateKey error:NULL]) {
    

    【讨论】:

      猜你喜欢
      • 2014-01-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-04
      • 1970-01-01
      • 1970-01-01
      • 2012-05-05
      • 2017-01-03
      相关资源
      最近更新 更多