如何从Finder Sync Extension访问用户文件夹?

时间:2017-03-24 11:38:08

标签: objective-c cocoa findersync

我正在使用Finder Extension开发一个Cocoa应用程序来在文件上设置叠加图标。

一旦用户点击我正在监控的文件夹,我就会接到电话 方法- beginObservingDirectoryAtURL:

所以我的代码是:

- (void)beginObservingDirectoryAtURL:(NSURL *)url {
    // The user is now seeing the container's contents.
    // If they see it in more than one view at a time, we're only told once.
    NSLog(@"Current Path : %@", url.path);
    NSArray<NSString*>* children = [[NSFileManager defaultManager] subPathsAtPath:url.Path];
}
从Finder扩展程序调用时,

[[NSFileManager defaultManager] subPathsAtPath:…]会返回nil

使用相同路径的相同方法调用将返回主应用程序中的元素。

我可以以某种方式启用从Finder Extension监控特定文件夹吗?

0 个答案:

没有答案