如何在Document目录中获取目录的URL路径?

Vij*_*jay 4 iphone directory nsfilemanager

如何获取文档目录中特定目录的URL路径.

喜欢 Document/Art/

我的代码

- (NSURL *)localRoot {
if (_localRoot != nil) {
    return _localRoot;
}

NSArray * paths = [[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask];

_localRoot = [paths objectAtIndex:0];
return _localRoot;
}
Run Code Online (Sandbox Code Playgroud)

上面的代码是Documents目录的url路径, 但我需要Art文档目录路径.

Raj*_*071 9

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

NSString *documentsDirectory = [paths objectAtIndex:0];

NSString *yourArtPath = [documentsDirectory stringByAppendingPathComponent:@"/Art"];
Run Code Online (Sandbox Code Playgroud)