【发布时间】:2015-11-04 17:34:22
【问题描述】:
我正在尝试使用 Xcode 创建的应用程序查看 Mac OS X 的下载目录。 下面是我尝试记录正在移动的文件的代码。但是,当我转到我的文档并移动文件时,甚至没有调用委托方法。有没有我想念的正确方法?
- (void)viewDidLoad {
[super viewDidLoad];
NSFileManager *manager = [[NSFileManager alloc] init]; // Do any additional setup after loading the view.
[manager setDelegate:self];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents folder
[manager changeCurrentDirectoryPath:documentsDirectory];
}
- (BOOL)fileManager:(NSFileManager *)fileManager shouldMoveItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath{
NSLog(@"Attempt to move");
return YES;
}
【问题讨论】:
-
iOS 还是 OSX?目前还不清楚。 stackoverflow.com/questions/1386743/… ?
标签: ios objective-c directory nsfilemanager