I'm using the following code to see if a URL is a folder:
getResourceValue always return NO and set isDir to nil even file is a URL to a folder.
Is there anything wrong with my code?
Code:
NSURL *file = [localFiles objectAtIndex:i];
NSNumber *isDir;
NSError* error1 = nil;
BOOL ret = [file getResourceValue:&isDir forKey:NSURLIsDirectoryKey error:&error1];
//NSDictionary *properties = [file resourceValuesForKeys:
// [NSArray arrayWithObject:NSURLIsDirectoryKey] error:&error1];
if (ret == NO) {
NSLog(@"Error when calling getResourceValue: %@", [error1 localizedDescription]);
}
getResourceValue always return NO and set isDir to nil even file is a URL to a folder.
Is there anything wrong with my code?