0
我想使用Xcode创建的应用程序观看mac OS X的下载目录。 下面是我用来记录正在移动的文件的代码。但是,当我转到我的文档并移动文件时,甚至不会调用委托方法。有没有适当的方式来做到这一点,我失踪了?IOS - 文件添加触发事件 - 是否有可能
- (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?目前尚不清楚。 http://stackoverflow.com/questions/1386743/observe-a-file-or-folder-in-objective-c? – Larme