将attributesOfItemAtPath插入NSFileManager

时间:2014-06-26 21:19:49

标签: objective-c nsurl nsfilemanager

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

我需要使用NSURL而不是myString。

我还是新手。

1 个答案:

答案 0 :(得分:2)

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]) {