Getting files (and its attributes) in a directory

后端 未结 1 523
半阙折子戏
半阙折子戏 2021-01-05 11:43

I want to get a list of files within a directory but I need to know if the file is a directory, when it was last modified, and offcourse its name :) . So I tried this:

相关标签:
1条回答
  • 2021-01-05 12:19

    This isn't the answer to your question but your error checking should look like this:

    if (![url getResourceValue:&name forKey:NSURLNameKey error:&error])
    {
        NSLog(@"name: %@", [error localizedDescription]);error = nil;
    }
    

    Edit

    Couldn't figure out what the problem was, but have just reread the documentation on the method. The important sentence is the one under discussion that says:

    This method is unimplemented in iOS, so it performs no operation.

    0 讨论(0)
提交回复
热议问题